Class: AbiCoderRb::FixedArray

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

Overview

class Array

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#dynamic?, parse

Constructor Details

#initialize(subtype, dim) ⇒ FixedArray

Returns a new instance of FixedArray.



184
185
186
187
# File 'lib/abi_coder_rb/types.rb', line 184

def initialize(subtype, dim)
  @subtype = subtype
  @dim = dim
end

Instance Attribute Details

#dimObject (readonly)

Returns the value of attribute dim.



182
183
184
# File 'lib/abi_coder_rb/types.rb', line 182

def dim
  @dim
end

#subtypeObject (readonly)

Returns the value of attribute subtype.



182
183
184
# File 'lib/abi_coder_rb/types.rb', line 182

def subtype
  @subtype
end

Instance Method Details

#==(other) ⇒ Object



197
198
199
200
201
# File 'lib/abi_coder_rb/types.rb', line 197

def ==(other)
  other.is_a?(FixedArray) &&
    @dim == other.dim &&
    @subtype == other.subtype
end

#formatObject



193
194
195
# File 'lib/abi_coder_rb/types.rb', line 193

def format
  "#{@subtype.format}[#{@dim}]"
end

#sizeObject



189
190
191
# File 'lib/abi_coder_rb/types.rb', line 189

def size
  @subtype.dynamic? ? nil : @dim * subtype.size
end