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.
402 403 404 405 |
# File 'lib/solidity/typed/metatypes/types.rb', line 402 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?
401 402 403 |
# File 'lib/solidity/typed/metatypes/types.rb', line 401 def event_class @event_class end |
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
400 401 402 |
# File 'lib/solidity/typed/metatypes/types.rb', line 400 def event_name @event_name end |
Instance Method Details
#==(other) ⇒ Object
check what abi looks like if possible for event
is like tuple?
416 417 418 419 420 |
# File 'lib/solidity/typed/metatypes/types.rb', line 416 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
406 407 408 409 410 |
# File 'lib/solidity/typed/metatypes/types.rb', line 406 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)
428 |
# File 'lib/solidity/typed/metatypes/types.rb', line 428 def mut?() false; end |
#new(initial_values) ⇒ Object
todo/check: change to values with splat - why? why not?
434 435 436 437 438 |
# File 'lib/solidity/typed/metatypes/types.rb', line 434 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
424 |
# File 'lib/solidity/typed/metatypes/types.rb', line 424 def typedclass() @event_class; end |
#typedclass_name ⇒ Object
423 |
# File 'lib/solidity/typed/metatypes/types.rb', line 423 def typedclass_name() @event_class.name; end |
#zero ⇒ Object Also known as: new_zero
429 430 431 |
# File 'lib/solidity/typed/metatypes/types.rb', line 429 def zero raise "event cannot be zero (by defintion); sorry" end |