Class: Yaic::Event
- Inherits:
-
Object
- Object
- Yaic::Event
- Defined in:
- lib/yaic/event.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(type:, message: nil, **attributes) ⇒ Event
constructor
A new instance of Event.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, message: nil, **attributes) ⇒ Event
Returns a new instance of Event.
7 8 9 10 11 |
# File 'lib/yaic/event.rb', line 7 def initialize(type:, message: nil, **attributes) @type = type = @attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object (private)
27 28 29 30 31 32 33 |
# File 'lib/yaic/event.rb', line 27 def method_missing(method_name, *args) if @attributes.key?(method_name) && args.empty? @attributes[method_name] else super end end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/yaic/event.rb', line 5 def end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/yaic/event.rb', line 5 def type @type end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/yaic/event.rb', line 13 def [](key) @attributes[key] end |
#to_h ⇒ Object
17 18 19 |
# File 'lib/yaic/event.rb', line 17 def to_h @attributes.dup end |