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.



667
668
669
670
# File 'lib/td/command/table.rb', line 667

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

Instance Method Details

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



672
673
674
675
676
677
678
679
680
681
# File 'lib/td/command/table.rb', line 672

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