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.



703
704
705
706
# File 'lib/td/command/table.rb', line 703

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

Instance Method Details

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



708
709
710
711
712
713
714
715
716
717
# File 'lib/td/command/table.rb', line 708

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