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.



747
748
749
750
# File 'lib/td/command/table.rb', line 747

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

Instance Method Details

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



752
753
754
755
756
757
758
759
760
761
# File 'lib/td/command/table.rb', line 752

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