Class: FFI::MsgPack::MsgMap
- Inherits:
-
Struct
- Object
- Struct
- FFI::MsgPack::MsgMap
- Defined in:
- lib/ffi/msgpack/msg_map.rb
Instance Method Summary collapse
-
#length ⇒ Integer
The length of the MsgPack Array.
-
#to_hash ⇒ Hash
The Hash of the Msg Maps keys and values.
Instance Method Details
#length ⇒ Integer
The length of the MsgPack Array.
17 18 19 |
# File 'lib/ffi/msgpack/msg_map.rb', line 17 def length self[:size] end |
#to_hash ⇒ Hash
The Hash of the Msg Maps keys and values.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ffi/msgpack/msg_map.rb', line 27 def to_hash hash = {} (0...self.length).each do |index| pair = MsgKeyValue.new(self[:ptr][index * MsgKeyValue.size]) hash[pair.key.to_ruby] = pair.value.to_ruby end return hash end |