Class: Etherlite::Types::ArrayDynamic

Inherits:
ArrayBase show all
Defined in:
lib/etherlite/types/array_dynamic.rb

Instance Attribute Summary

Attributes inherited from ArrayBase

#subtype

Instance Method Summary collapse

Methods inherited from ArrayBase

#initialize

Methods inherited from Base

#decode, #dynamic?, #fixed?, #size

Constructor Details

This class inherits a constructor from Etherlite::Types::ArrayBase

Instance Method Details

#encode(_value) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/etherlite/types/array_dynamic.rb', line 7

def encode(_value)
  raise ArgumentError, "expected an array for #{signature}" unless _value.is_a? Array

  Etherlite::Utils.uint_to_hex(_value.size) + encode_values(_value)
end

#signatureObject



3
4
5
# File 'lib/etherlite/types/array_dynamic.rb', line 3

def signature
  "#{subtype.signature}[]"
end