Class: ABI::Type

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

Direct Known Subclasses

Address, Array, Bool, Bytes, FixedArray, FixedBytes, Int, String, Tuple, Uint

Defined Under Namespace

Classes: ParseError, Parser

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(type) ⇒ Object

convenience helper



12
13
14
# File 'lib/abicoder/types.rb', line 12

def self.parse( type )   ## convenience helper
  Parser.parse( type )
end

Instance Method Details

#dynamic?Boolean

Returns:

  • (Boolean)


25
# File 'lib/abicoder/types.rb', line 25

def dynamic?() size.nil?; end

#formatObject

Raises:

  • (ArgumentError)


27
28
29
30
# File 'lib/abicoder/types.rb', line 27

def format
  ## check/todo: what error to raise for not implemented / method not defined???
  raise ArgumentError, "no required format method defined for Type subclass #{self.class.name}; sorry"
end

#sizeInteger, NilClass

Get the static size of a type, or nil if dynamic.

Returns:

  • (Integer, NilClass)

    size of static type, or nil for dynamic type

Raises:

  • (ArgumentError)


21
22
23
24
# File 'lib/abicoder/types.rb', line 21

def size
  ## check/todo: what error to raise for not implemented / method not defined???
  raise ArgumentError, "no required size method defined for Type subclass #{self.class.name}; sorry"
end