Module: MsgPackable::Bloomed::ClassMethods
- Defined in:
- lib/bloomed/msg_packable.rb
Instance Method Summary collapse
Instance Method Details
#from_msgpack(data) ⇒ Object
24 25 26 |
# File 'lib/bloomed/msg_packable.rb', line 24 def from_msgpack(data) msgpack_factory.load(data) end |
#from_msgpack_ext(data) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/bloomed/msg_packable.rb', line 28 def from_msgpack_ext(data) values = msgpack_factory.load(data) ::Bloomed::PW.new.tap do |b| b.from_msgpack_ext(*values) end end |
#msgpack_factory ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/bloomed/msg_packable.rb', line 35 def msgpack_factory @msgpack_factory ||= ::MessagePack::Factory.new.tap do |factory| factory.register_type(0x01, ::Bloomer) factory.register_type(0x02, ::Bloomer::Scalable) factory.register_type(0x03, ::Bloomed::PW) factory.freeze end end |