Class: ABI::Int

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

Overview

class FixedBytes

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#dynamic?, parse

Constructor Details

#initialize(bits = 256) ⇒ Int

Returns a new instance of Int.



66
67
68
# File 'lib/abicoder/types.rb', line 66

def initialize( bits=256 )
  @bits = bits  # in bits (8,16,...256)
end

Instance Attribute Details

#bitsObject (readonly)

Returns the value of attribute bits.



65
66
67
# File 'lib/abicoder/types.rb', line 65

def bits
  @bits
end

Instance Method Details

#==(another_type) ⇒ Object



71
72
73
# File 'lib/abicoder/types.rb', line 71

def ==(another_type)
   another_type.kind_of?( Int ) && @bits == another_type.bits
end

#formatObject



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

def format() "int#{@bits}"; end

#sizeObject

note: always uses 32 bytes (with padding)



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

def size() 32;  end