Class: ABI::Int
Overview
class FixedBytes
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
Instance Method Summary collapse
- #==(another_type) ⇒ Object
- #format ⇒ Object
-
#initialize(bits = 256) ⇒ Int
constructor
A new instance of Int.
-
#size ⇒ Object
note: always uses 32 bytes (with padding).
Methods inherited from Type
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
#bits ⇒ Object (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 |
#format ⇒ Object
70 |
# File 'lib/abicoder/types.rb', line 70 def format() "int#{@bits}"; end |
#size ⇒ Object
note: always uses 32 bytes (with padding)
69 |
# File 'lib/abicoder/types.rb', line 69 def size() 32; end |