class FFI::MsgPack::MsgMap

Public Instance Methods

length() click to toggle source

The length of the MsgPack Array.

@return [Integer]

The length of the Array.
# File lib/ffi/msgpack/msg_map.rb, line 18
def length
  self[:size]
end
to_hash() click to toggle source

The Hash of the Msg Maps keys and values.

@return [Hash]

The Hash of the key->value values.
# File lib/ffi/msgpack/msg_map.rb, line 28
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