Class: OfflineSort::Chunk::InputOutput::MessagePack
- Defined in:
- lib/offline_sort/chunk/input_output/message_pack.rb
Constant Summary
Constants inherited from Base
Base::MethodNotImplementedError
Instance Attribute Summary collapse
-
#packer ⇒ Object
readonly
Returns the value of attribute packer.
-
#unpacker ⇒ Object
readonly
Returns the value of attribute unpacker.
Attributes inherited from Base
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(io) ⇒ MessagePack
constructor
A new instance of MessagePack.
- #read_entry ⇒ Object
- #write_entry(entry) ⇒ Object
Methods inherited from Base
#close, #each, #rewind, #write_entries
Constructor Details
#initialize(io) ⇒ MessagePack
Returns a new instance of MessagePack.
10 11 12 13 14 |
# File 'lib/offline_sort/chunk/input_output/message_pack.rb', line 10 def initialize(io) super @packer = ::MessagePack::Packer.new(io) @unpacker = ::MessagePack::Unpacker.new(io) end |
Instance Attribute Details
#packer ⇒ Object (readonly)
Returns the value of attribute packer.
8 9 10 |
# File 'lib/offline_sort/chunk/input_output/message_pack.rb', line 8 def packer @packer end |
#unpacker ⇒ Object (readonly)
Returns the value of attribute unpacker.
8 9 10 |
# File 'lib/offline_sort/chunk/input_output/message_pack.rb', line 8 def unpacker @unpacker end |
Instance Method Details
#flush ⇒ Object
24 25 26 27 |
# File 'lib/offline_sort/chunk/input_output/message_pack.rb', line 24 def flush packer.flush super end |
#read_entry ⇒ Object
16 17 18 |
# File 'lib/offline_sort/chunk/input_output/message_pack.rb', line 16 def read_entry unpacker.read end |
#write_entry(entry) ⇒ Object
20 21 22 |
# File 'lib/offline_sort/chunk/input_output/message_pack.rb', line 20 def write_entry(entry) packer.write(entry) end |