Class: SimpleTools::Events::Subscriber
- Inherits:
-
Object
- Object
- SimpleTools::Events::Subscriber
- Defined in:
- lib/simple_tools/events/subscriber.rb
Constant Summary collapse
- BehaviourNotDefined =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(event_name, payload) ⇒ Subscriber
constructor
A new instance of Subscriber.
Constructor Details
#initialize(event_name, payload) ⇒ Subscriber
Returns a new instance of Subscriber.
14 15 16 17 |
# File 'lib/simple_tools/events/subscriber.rb', line 14 def initialize(event_name, payload) @event_name = event_name @payload = payload end |
Instance Attribute Details
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
8 9 10 |
# File 'lib/simple_tools/events/subscriber.rb', line 8 def event_name @event_name end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
8 9 10 |
# File 'lib/simple_tools/events/subscriber.rb', line 8 def payload @payload end |
Class Method Details
.notify(event_name, payload) ⇒ Object
10 11 12 |
# File 'lib/simple_tools/events/subscriber.rb', line 10 def self.notify(event_name, payload) new(event_name, payload).call end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'lib/simple_tools/events/subscriber.rb', line 19 def call handle end |