Class: UniversalID::Packer
- Inherits:
-
Object
- Object
- UniversalID::Packer
- Defined in:
- lib/universalid/packer.rb
Class Method Summary collapse
Class Method Details
.pack(object, options = {}) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/universalid/packer.rb', line 5 def pack(object, = {}) object = UniversalID::Prepacker.prepack(object, ) # This is basically the same call as UniversalID::MessagePackFactory.pack(object), # but it uses a pool of pre-initialized packers/unpackers instead of creating a new one each time UniversalID::MessagePackFactory.msgpack_pool.dump object end |
.unpack(string) ⇒ Object
13 14 15 16 17 |
# File 'lib/universalid/packer.rb', line 13 def unpack(string) # This is basically the same call as UniversalID::MessagePackFactory.unpack(object), # but it uses a pool of pre-initialized packers/unpackers instead of creating a new one each time UniversalID::MessagePackFactory.msgpack_pool.load string end |