Class: Types::InscriptionId

Inherits:
TypedValue show all
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

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 = INSCRIPTION_ID_ZERO) ⇒ InscriptionId

Returns a new instance of InscriptionId.

Raises:

  • (ArgumentError)


61
62
63
64
65
66
67
68
69
70
# File 'lib/solidity/typed/values.rb', line 61

def initialize( initial_value = INSCRIPTION_ID_ZERO )
  ##  was: nitial_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

.typeObject



57
# File 'lib/solidity/typed/values.rb', line 57

def self.type() InscriptionIdType.instance; end

.zeroObject



58
# File 'lib/solidity/typed/values.rb', line 58

def self.zero() @zero ||= new; end

Instance Method Details

#zero?Boolean

Returns:

  • (Boolean)


59
# File 'lib/solidity/typed/values.rb', line 59

def zero?() @value == INSCRIPTION_ID_ZERO; end