Class: AbiCoderRb::Uint
Overview
class Int
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #format ⇒ Object
-
#initialize(bits = 256) ⇒ Uint
constructor
A new instance of Uint.
-
#size ⇒ Object
note: always uses 32 bytes (with padding).
Methods inherited from Type
Constructor Details
#initialize(bits = 256) ⇒ Uint
Returns a new instance of Uint.
112 113 114 |
# File 'lib/abi_coder_rb/types.rb', line 112 def initialize(bits = 256) @bits = bits # in bits (8,16,...256) end |
Instance Attribute Details
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
110 111 112 |
# File 'lib/abi_coder_rb/types.rb', line 110 def bits @bits end |
Instance Method Details
#==(other) ⇒ Object
125 126 127 |
# File 'lib/abi_coder_rb/types.rb', line 125 def ==(other) other.is_a?(Uint) && @bits == other.bits end |
#format ⇒ Object
121 122 123 |
# File 'lib/abi_coder_rb/types.rb', line 121 def format "uint#{@bits}" end |
#size ⇒ Object
note: always uses 32 bytes (with padding)
117 118 119 |
# File 'lib/abi_coder_rb/types.rb', line 117 def size 32 end |