Class: FFI::MsgPack::MsgArray

Inherits:
Struct
  • Object
show all
Defined in:
lib/ffi/msgpack/msg_array.rb

Instance Method Summary collapse

Instance Method Details

#lengthInteger

The length of the MsgPack Array.

Returns:

  • (Integer)

    The length of the Array.



17
18
19
# File 'lib/ffi/msgpack/msg_array.rb', line 17

def length
  self[:size]
end

#to_aArray<Object>

The Array of values.

Returns:

  • (Array<Object>)

    The values contained within the Array.



27
28
29
30
31
# File 'lib/ffi/msgpack/msg_array.rb', line 27

def to_a
  (0...self.length).map do |index|
    MsgObject.new(self[:ptr][index * MsgObject.size]).to_ruby
  end
end