Class: Types::Bytes
- Inherits:
-
TypedValue
- Object
- Typed
- TypedValue
- Types::Bytes
- 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 = BYTES_ZERO) ⇒ Bytes
constructor
A new instance of Bytes.
- #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 = BYTES_ZERO) ⇒ Bytes
Returns a new instance of Bytes.
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/solidity/typed/values.rb', line 98 def initialize( initial_value = BYTES_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
94 |
# File 'lib/solidity/typed/values.rb', line 94 def self.type() BytesType.instance; end |
.zero ⇒ Object
95 |
# File 'lib/solidity/typed/values.rb', line 95 def self.zero() @zero ||= new; end |
Instance Method Details
#zero? ⇒ Boolean
96 |
# File 'lib/solidity/typed/values.rb', line 96 def zero?() @value == BYTES_ZERO; end |