Class: AbiCoderRb::Int
Overview
class FixedBytes
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
Instance Method Summary collapse
- #==(other) ⇒ 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.
91 92 93 |
# File 'lib/abi_coder_rb/types.rb', line 91 def initialize(bits = 256) @bits = bits # in bits (8,16,...256) end |
Instance Attribute Details
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
89 90 91 |
# File 'lib/abi_coder_rb/types.rb', line 89 def bits @bits end |
Instance Method Details
#==(other) ⇒ Object
104 105 106 |
# File 'lib/abi_coder_rb/types.rb', line 104 def ==(other) other.is_a?(Int) && @bits == other.bits end |
#format ⇒ Object
100 101 102 |
# File 'lib/abi_coder_rb/types.rb', line 100 def format "int#{@bits}" end |
#size ⇒ Object
note: always uses 32 bytes (with padding)
96 97 98 |
# File 'lib/abi_coder_rb/types.rb', line 96 def size 32 end |