Class: Types::TypedValue
Overview
add value & reference type base - why? why not?
Direct Known Subclasses
Address, Bytes, Bytes32, InscriptionId, Int, String, Timedelta, Timestamp, UInt
Constant Summary
Constants inherited from Typed
Types::Typed::ADDRESS_ZERO, Types::Typed::BYTES20_ZERO, Types::Typed::BYTES32_ZERO, Types::Typed::BYTES_ZERO, Types::Typed::INSCRIPTION_ID_ZERO, Types::Typed::STRING_ZERO
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#as_data ⇒ Object
todo/check – use self.zero or such - why? why not?.
-
#eql?(other) ⇒ Boolean
todo/check - hash == other.hash is default any way??.
- #hash ⇒ Object
- #pretty_print(printer) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Typed
#as_json, dump, serialize, #serialize, #type, type
Instance Method Details
#==(other) ⇒ Object
86 87 88 89 90 |
# File 'lib/solidity/typed/typed.rb', line 86 def ==(other) other.is_a?(self.class) && type == other.type && ## note: type for no redundant (always the same if same class AND TypedValue) @value == other.instance_variable_get( :@value ) ## compare value via as_data!!! end |
#as_data ⇒ Object
todo/check – use self.zero or such - why? why not?
74 |
# File 'lib/solidity/typed/typed.rb', line 74 def as_data() @value; end |
#eql?(other) ⇒ Boolean
todo/check - hash == other.hash is default any way??
94 |
# File 'lib/solidity/typed/typed.rb', line 94 def eql?(other) hash == other.hash; end |
#hash ⇒ Object
92 |
# File 'lib/solidity/typed/typed.rb', line 92 def hash() [@value, type].hash; end |
#pretty_print(printer) ⇒ Object
76 |
# File 'lib/solidity/typed/typed.rb', line 76 def pretty_print( printer ) printer.text( "<val #{type}:#{@value.inspect}>" ); end |
#to_s ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/solidity/typed/typed.rb', line 78 def to_s if @value.is_a?(::String) || @value.is_a?(::Integer) @value.to_s else raise "no string conversion of value possible; sorry" end end |