Class: ABI::Uint

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

Overview

class Int

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#dynamic?, parse

Constructor Details

#initialize(bits = 256) ⇒ Uint

Returns a new instance of Uint.



78
79
80
# File 'lib/abicoder/types.rb', line 78

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

Instance Attribute Details

#bitsObject (readonly)

Returns the value of attribute bits.



77
78
79
# File 'lib/abicoder/types.rb', line 77

def bits
  @bits
end

Instance Method Details

#==(another_type) ⇒ Object



83
84
85
# File 'lib/abicoder/types.rb', line 83

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

#formatObject



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

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

#sizeObject

note: always uses 32 bytes (with padding)



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

def size() 32;  end