Kouhei Sutou
null+****@clear*****
Mon Jan 15 15:31:58 JST 2018
Kouhei Sutou 2018-01-15 15:31:58 +0900 (Mon, 15 Jan 2018) New Revision: b4190bb1062c9075ccbcf50f00fb79fff39f5ed1 https://github.com/groonga/groonga-log/commit/b4190bb1062c9075ccbcf50f00fb79fff39f5ed1 Message: Add Parser#current_path Modified files: lib/groonga-log/parser.rb Modified: lib/groonga-log/parser.rb (+11 -1) =================================================================== --- lib/groonga-log/parser.rb 2018-01-15 15:16:11 +0900 (c004ceb) +++ lib/groonga-log/parser.rb 2018-01-15 15:31:58 +0900 (dba7cdf) @@ -54,6 +54,11 @@ module GroongaLog end end + attr_reader :current_path + def initialize + @current_path = nil + end + def parse(input) return to_enum(:parse, input) unless block_given? @@ -88,7 +93,12 @@ module GroongaLog target_paths = self.class.sort_paths(paths) target_paths.each do |path| Input.open(path) do |log| - parse(log, &block) + @current_path = path + begin + parse(log, &block) + ensure + @current_path = nil + end end end end -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180115/5a19d49d/attachment-0001.htm