Class: RubyEventStore::PubSub::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/pub_sub/dispatcher.rb

Instance Method Summary collapse

Instance Method Details

#call(subscriber, event) ⇒ Object



4
5
6
# File 'lib/ruby_event_store/pub_sub/dispatcher.rb', line 4

def call(subscriber, event)
  subscriber.call(event)
end

#proxy_for(klass) ⇒ Object

Raises:



8
9
10
11
# File 'lib/ruby_event_store/pub_sub/dispatcher.rb', line 8

def proxy_for(klass)
  raise InvalidHandler.new(klass) unless klass.method_defined?(:call)
  ->(e) { klass.new.call(e) }
end