Class: Types::Address
- Inherits:
 - 
      TypedValue
      
        
- Object
 - Typed
 - TypedValue
 - Types::Address
 
 
- Includes:
 - Comparable
 
- 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
- #<=>(other) ⇒ Object
 - 
  
    
      #initialize(initial_value = ADDRESS_ZERO)  ⇒ Address 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Address.
 - 
  
    
      #to_uint  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
add helper here - why? why not?.
 - #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 = ADDRESS_ZERO) ⇒ Address
Returns a new instance of Address.
      57 58 59 60 61 62 63 64 65 66  | 
    
      # File 'lib/solidity/typed/values.rb', line 57 def initialize( initial_value = ADDRESS_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
      52  | 
    
      # File 'lib/solidity/typed/values.rb', line 52 def self.type() AddressType.instance; end  | 
  
.zero ⇒ Object
      53  | 
    
      # File 'lib/solidity/typed/values.rb', line 53 def self.zero() @zero ||= new; end  | 
  
Instance Method Details
#<=>(other) ⇒ Object
      70 71 72 73 74 75 76 77 78  | 
    
      # File 'lib/solidity/typed/values.rb', line 70 def <=>(other) ## compare hexstring instead of unint? - why? why not? if other.is_a?(Address) to_uint <=> other.to_uint else ## use type error or retur nil? raise ArgumentError, "Address#<=>(other) expects Address; got #{other.class.name}" end end  | 
  
#to_uint ⇒ Object
add helper here - why? why not?
      81 82 83 84  | 
    
      # File 'lib/solidity/typed/values.rb', line 81 def to_uint ## add helper here - why? why not? num = @value.to_i(16) UInt.new( num ) end  | 
  
#zero? ⇒ Boolean
      54  | 
    
      # File 'lib/solidity/typed/values.rb', line 54 def zero?() @value == ADDRESS_ZERO; end  |