Class: ABI::Tuple

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

Overview

class FixedArray

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#dynamic?, parse

Constructor Details

#initialize(types) ⇒ Tuple

Returns a new instance of Tuple.



134
135
136
# File 'lib/abicoder/types.rb', line 134

def initialize( types )
  @types = types
end

Instance Attribute Details

#typesObject (readonly)

Returns the value of attribute types.



132
133
134
# File 'lib/abicoder/types.rb', line 132

def types
  @types
end

Instance Method Details

#==(another_type) ⇒ Object



150
151
152
# File 'lib/abicoder/types.rb', line 150

def ==(another_type)
  another_type.kind_of?( Tuple ) && @types == another_type.types
end

#formatObject



147
148
149
# File 'lib/abicoder/types.rb', line 147

def format
  "(#{@types.map {|t| t.format }.join(',')})"  ## rebuild minimal string
end

#sizeObject



138
139
140
141
142
143
144
145
146
# File 'lib/abicoder/types.rb', line 138

def size
  s = 0
  @types.each do |type|
    ts = type.size
    return nil   if ts.nil?
    s += ts
  end
  s
end