Class: TreasureData::Command::JsonParser
- Inherits:
-
StructuredParser
- Object
- StructuredParser
- TreasureData::Command::JsonParser
- Defined in:
- lib/td/command/table.rb
Instance Method Summary collapse
- #call(file, path, &block) ⇒ Object
-
#initialize(time_key) ⇒ JsonParser
constructor
A new instance of JsonParser.
Constructor Details
#initialize(time_key) ⇒ JsonParser
Returns a new instance of JsonParser.
649 650 651 652 |
# File 'lib/td/command/table.rb', line 649 def initialize(time_key) require 'json' @time_key = time_key end |
Instance Method Details
#call(file, path, &block) ⇒ Object
654 655 656 657 658 659 660 661 662 663 |
# File 'lib/td/command/table.rb', line 654 def call(file, path, &block) file.each_line {|line| begin record = JSON.parse(line) sanitize_record(record, &block) rescue $stderr.puts " skipped: #{$!}: #{record.to_json}" end } end |