Class: Types::Typed::ErrorType
- Inherits:
-
ReferenceType
- Object
- Type
- ReferenceType
- Types::Typed::ErrorType
- Defined in:
- lib/solidity/typed/metatypes/types.rb
Overview
error for now kind of like a struct - why? why not?
but MUST be initialized (and than frozen)
and no zero possible etc.
Instance Attribute Summary collapse
-
#error_class ⇒ Object
readonly
reference error_class here - why? why not?.
-
#error_name ⇒ Object
readonly
Returns the value of attribute error_name.
Instance Method Summary collapse
-
#==(other) ⇒ Object
check what abi looks like if possible for error is like tuple?.
- #format ⇒ Object (also: #to_s)
-
#initialize(error_name, error_class) ⇒ ErrorType
constructor
A new instance of ErrorType.
-
#mut? ⇒ Boolean
note: mut? == true MUST use new_zero (dup) mut? == false MUST use zero (frozen/shared/singelton).
-
#new(initial_values) ⇒ Object
todo/check: change to values with splat - why? why not?.
- #typedclass ⇒ Object
- #typedclass_name ⇒ Object
- #zero ⇒ Object (also: #new_zero)
Methods inherited from Type
#array?, #check_and_normalize_literal, #eql?, #hash, #mapping?, #parse_integer, #pretty_print, #raise_type_error
Constructor Details
#initialize(error_name, error_class) ⇒ ErrorType
Returns a new instance of ErrorType.
451 452 453 454 |
# File 'lib/solidity/typed/metatypes/types.rb', line 451 def initialize( error_name, error_class ) @error_name = error_name @error_class = error_class end |
Instance Attribute Details
#error_class ⇒ Object (readonly)
reference error_class here - why? why not?
450 451 452 |
# File 'lib/solidity/typed/metatypes/types.rb', line 450 def error_class @error_class end |
#error_name ⇒ Object (readonly)
Returns the value of attribute error_name.
449 450 451 |
# File 'lib/solidity/typed/metatypes/types.rb', line 449 def error_name @error_name end |
Instance Method Details
#==(other) ⇒ Object
check what abi looks like if possible for error
is like tuple?
465 466 467 468 469 |
# File 'lib/solidity/typed/metatypes/types.rb', line 465 def ==(other) other.is_a?( ErrorType ) && @error_name == other.error_name && ## check for name too - why? why not? @error_class == other.error_class end |
#format ⇒ Object Also known as: to_s
455 456 457 458 459 |
# File 'lib/solidity/typed/metatypes/types.rb', line 455 def format ## use tuple here (not error) - why? why not? named_types = @error_class.attributes.map {|key,type| "#{key} #{type.format}" } "#{@error_name} error(#{named_types.join(',')})" end |
#mut? ⇒ Boolean
note: mut? == true MUST use new_zero (dup)
mut? == false MUST use zero (frozen/shared/singelton)
477 |
# File 'lib/solidity/typed/metatypes/types.rb', line 477 def mut?() false; end |
#new(initial_values) ⇒ Object
todo/check: change to values with splat - why? why not?
483 484 485 486 487 |
# File 'lib/solidity/typed/metatypes/types.rb', line 483 def new( initial_values ) ## todo/check: change to values with splat - why? why not? ## note: use "splat" here - must be empty or matching number of fields/attributes ## change - why? why not? @error_class.new( *initial_values ) end |
#typedclass ⇒ Object
473 |
# File 'lib/solidity/typed/metatypes/types.rb', line 473 def typedclass() @error_class; end |
#typedclass_name ⇒ Object
472 |
# File 'lib/solidity/typed/metatypes/types.rb', line 472 def typedclass_name() @error_class.name; end |
#zero ⇒ Object Also known as: new_zero
478 479 480 |
# File 'lib/solidity/typed/metatypes/types.rb', line 478 def zero raise "error cannot be zero (by defintion); sorry" end |