Class: RabbitFeed::EventRouting::Event
- Inherits:
-
Object
- Object
- RabbitFeed::EventRouting::Event
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/rabbit_feed/event_routing.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #handle_event(event) ⇒ Object
-
#initialize(name, block) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(name, block) ⇒ Event
Returns a new instance of Event.
10 11 12 13 14 15 |
# File 'lib/rabbit_feed/event_routing.rb', line 10 def initialize(name, block) @name = name @action = block validate! end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
6 7 8 |
# File 'lib/rabbit_feed/event_routing.rb', line 6 def action @action end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/rabbit_feed/event_routing.rb', line 6 def name @name end |
Instance Method Details
#handle_event(event) ⇒ Object
17 18 19 |
# File 'lib/rabbit_feed/event_routing.rb', line 17 def handle_event(event) action.call event end |