Class: TreasureData::Command::MessagePackParser

Inherits:
StructuredParser show all
Defined in:
lib/td/command/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(time_key) ⇒ MessagePackParser

Returns a new instance of MessagePackParser.



637
638
639
640
# File 'lib/td/command/table.rb', line 637

def initialize(time_key)
  require 'msgpack'
  @time_key = time_key
end

Instance Method Details

#call(file, path, &block) ⇒ Object



642
643
644
645
646
647
648
649
650
651
# File 'lib/td/command/table.rb', line 642

def call(file, path, &block)
  MessagePack::Unpacker.new(file).each {|record|
    begin
      sanitize_record(record, &block)
    rescue
      $stderr.puts "  skipped: #{$!}: #{record.to_json}"
    end
  }
rescue EOFError
end