class RabbitFeed::EventRouting::Event
Attributes
action[R]
name[R]
Public Class Methods
new(name, block)
click to toggle source
# File lib/rabbit_feed/event_routing.rb, line 10 def initialize(name, block) @name = name @action = block validate! end
Public Instance Methods
handle_event(event)
click to toggle source
# File lib/rabbit_feed/event_routing.rb, line 17 def handle_event(event) action.call event end
Private Instance Methods
action_arity()
click to toggle source
# File lib/rabbit_feed/event_routing.rb, line 23 def action_arity errors.add(:action, 'arity should be 1') if action.present? && action.arity != 1 end
validate!()
click to toggle source
# File lib/rabbit_feed/event_routing.rb, line 27 def validate! raise ConfigurationError, "Bad event specification for #{name}: #{errors.messages}" if invalid? end