Class: Types::Typed::ContractType

Inherits:
ValueType show all
Defined in:
lib/solidity/typed/metatypes/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#array?, #check_and_normalize_literal, #eql?, #hash, #mapping?, #parse_integer, #pretty_print, #raise_type_error, #zero

Constructor Details

#initialize(contract_type) ⇒ ContractType

note: assume for now contract_type is a (contract) class!!!!!

Raises:

  • (ArgumentError)


466
467
468
469
# File 'lib/solidity/typed/metatypes/types.rb', line 466

def initialize( contract_type )
  raise ArgumentError, "[ContractType#initialize] class expected for contract_type arg"  unless contract_type.is_a?( Class )
  @contract_type = contract_type
end

Instance Attribute Details

#contract_typeObject (readonly)

Returns the value of attribute contract_type.



464
465
466
# File 'lib/solidity/typed/metatypes/types.rb', line 464

def contract_type
  @contract_type
end

Class Method Details

.instance(contract_type) ⇒ Object

Raises:

  • (ArgumentError)


458
459
460
461
462
# File 'lib/solidity/typed/metatypes/types.rb', line 458

def self.instance( contract_type ) 
  raise ArgumentError, "[ContractType.insntance] class expected for contract_type arg"  unless contract_type.is_a?( Class )
  @instances ||= {}
  @instances[ contract_type.name ] ||= new( contract_type ) 
end

Instance Method Details

#==(other) ⇒ Object



474
475
476
477
# File 'lib/solidity/typed/metatypes/types.rb', line 474

def ==(other)
  other.is_a?( ContractType ) && 
  @contract_type  == other.contract_type
end

#formatObject Also known as: to_s



471
# File 'lib/solidity/typed/metatypes/types.rb', line 471

def format() "contract(#{@contract_type.name})"; end

#mut?Boolean

Returns:

  • (Boolean)


480
# File 'lib/solidity/typed/metatypes/types.rb', line 480

def mut?() false; end

#new(initial_value) ⇒ Object

add support with passed in address - why? why not?

Raises:

  • (NameError)


482
483
484
# File 'lib/solidity/typed/metatypes/types.rb', line 482

def new( initial_value ) 
  raise NameError, "no method create for ContractType; sorry"
end