Class: Types::Typed::EventType
- Inherits:
-
ReferenceType
- Object
- Type
- ReferenceType
- Types::Typed::EventType
- Defined in:
- lib/solidity/typed/metatypes/types.rb
Overview
event 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
-
#event_class ⇒ Object
readonly
reference event_class here - why? why not?.
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
Instance Method Summary collapse
-
#==(other) ⇒ Object
check what abi looks like if possible for event is like tuple?.
- #format ⇒ Object (also: #to_s)
-
#initialize(event_name, event_class) ⇒ EventType
constructor
A new instance of EventType.
-
#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(event_name, event_class) ⇒ EventType
Returns a new instance of EventType.
403 404 405 406 |
# File 'lib/solidity/typed/metatypes/types.rb', line 403 def initialize( event_name, event_class ) @event_name = event_name @event_class = event_class end |
Instance Attribute Details
#event_class ⇒ Object (readonly)
reference event_class here - why? why not?
402 403 404 |
# File 'lib/solidity/typed/metatypes/types.rb', line 402 def event_class @event_class end |
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
401 402 403 |
# File 'lib/solidity/typed/metatypes/types.rb', line 401 def event_name @event_name end |
Instance Method Details
#==(other) ⇒ Object
check what abi looks like if possible for event
is like tuple?
417 418 419 420 421 |
# File 'lib/solidity/typed/metatypes/types.rb', line 417 def ==(other) other.is_a?( EventType ) && @event_name == other.event_name && ## check for name too - why? why not? @event_class == other.event_class end |
#format ⇒ Object Also known as: to_s
407 408 409 410 411 |
# File 'lib/solidity/typed/metatypes/types.rb', line 407 def format ## use tuple here (not event) - why? why not? named_types = @event_class.attributes.map {|key,type| "#{key} #{type.format}" } "#{@event_name} event(#{named_types.join(',')})" end |
#mut? ⇒ Boolean
note: mut? == true MUST use new_zero (dup)
mut? == false MUST use zero (frozen/shared/singelton)
429 |
# File 'lib/solidity/typed/metatypes/types.rb', line 429 def mut?() false; end |
#new(initial_values) ⇒ Object
todo/check: change to values with splat - why? why not?
435 436 437 438 439 |
# File 'lib/solidity/typed/metatypes/types.rb', line 435 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? @event_class.new( *initial_values ) end |
#typedclass ⇒ Object
425 |
# File 'lib/solidity/typed/metatypes/types.rb', line 425 def typedclass() @event_class; end |
#typedclass_name ⇒ Object
424 |
# File 'lib/solidity/typed/metatypes/types.rb', line 424 def typedclass_name() @event_class.name; end |
#zero ⇒ Object Also known as: new_zero
430 431 432 |
# File 'lib/solidity/typed/metatypes/types.rb', line 430 def zero raise "event cannot be zero (by defintion); sorry" end |