Class: AbiCoderRb::FixedArray

Inherits:
Type
  • Object
show all
Defined in:
lib/abi_coder_rb/type/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#dynamic?, parse

Constructor Details

#initialize(inner_type, length) ⇒ FixedArray

Returns a new instance of FixedArray.



155
156
157
158
# File 'lib/abi_coder_rb/type/types.rb', line 155

def initialize(inner_type, length)
  @inner_type = inner_type
  @length = length
end

Instance Attribute Details

#inner_typeObject (readonly)

Returns the value of attribute inner_type.



153
154
155
# File 'lib/abi_coder_rb/type/types.rb', line 153

def inner_type
  @inner_type
end

#lengthObject (readonly)

Returns the value of attribute length.



153
154
155
# File 'lib/abi_coder_rb/type/types.rb', line 153

def length
  @length
end

Instance Method Details

#==(other) ⇒ Object



168
169
170
# File 'lib/abi_coder_rb/type/types.rb', line 168

def ==(other)
  other.is_a?(FixedArray) && @length == other.length && @inner_type == other.inner_type
end

#formatObject



164
165
166
# File 'lib/abi_coder_rb/type/types.rb', line 164

def format
  "#{@inner_type.format}[#{@length}]"
end

#sizeObject



160
161
162
# File 'lib/abi_coder_rb/type/types.rb', line 160

def size
  @inner_type.dynamic? ? nil : @length * inner_type.size
end