Class: Transit::Unmarshaler::MessagePack Private

Inherits:
Object
  • Object
show all
Defined in:
lib/transit/unmarshaler/cruby/messagepack.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(io, opts) ⇒ MessagePack

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MessagePack.



24
25
26
27
# File 'lib/transit/unmarshaler/cruby/messagepack.rb', line 24

def initialize(io, opts)
  @decoder = Transit::Decoder.new(opts)
  @unpacker = ::MessagePack::Unpacker.new(io)
end

Instance Method Details

#readObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

See Also:



30
31
32
33
34
35
36
# File 'lib/transit/unmarshaler/cruby/messagepack.rb', line 30

def read
  if block_given?
    @unpacker.each {|v| yield @decoder.decode(v)}
  else
    @decoder.decode(@unpacker.read)
  end
end