Class: Types::Bytes32
- Inherits:
-
TypedValue
- Object
- Typed
- TypedValue
- Types::Bytes32
- Defined in:
- lib/solidity/typed/values.rb
Constant Summary
Constants inherited from Typed
Typed::ADDRESS_ZERO, Typed::BYTES20_ZERO, Typed::BYTES32_ZERO, Typed::BYTES_ZERO, Typed::INSCRIPTION_ID_ZERO, Typed::STRING_ZERO
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(initial_value = BYTES32_ZERO) ⇒ Bytes32
constructor
A new instance of Bytes32.
- #zero? ⇒ Boolean
Methods inherited from TypedValue
#==, #as_data, #eql?, #hash, #pretty_print, #to_s
Methods inherited from Typed
#as_data, #as_json, dump, serialize, #serialize, #type
Constructor Details
#initialize(initial_value = BYTES32_ZERO) ⇒ Bytes32
Returns a new instance of Bytes32.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/solidity/typed/values.rb', line 113 def initialize( initial_value = BYTES32_ZERO ) ## was: initial_value ||= type.zero ## check if nil gets passed in - default not used? raise ArgumentError, "expected literal of type #{type}; got typed #{initial_value.pretty_print_inspect}" if initial_value.is_a?( Typed ) @value = type.check_and_normalize_literal( initial_value ) @value.freeze ## freeze here - why? why not? @value end |
Class Method Details
.type ⇒ Object
109 |
# File 'lib/solidity/typed/values.rb', line 109 def self.type() Bytes32Type.instance; end |
.zero ⇒ Object
110 |
# File 'lib/solidity/typed/values.rb', line 110 def self.zero() @zero ||= new; end |
Instance Method Details
#zero? ⇒ Boolean
111 |
# File 'lib/solidity/typed/values.rb', line 111 def zero?() @value == BYTES32_ZERO; end |