Module: Horizon::Handler::ClassMethods

Defined in:
lib/horizon/handler.rb

Instance Method Summary collapse

Instance Method Details

#events_handledObject



12
13
14
# File 'lib/horizon/handler.rb', line 12

def events_handled
  handlers.keys
end

#handler(event) ⇒ Object



16
17
18
# File 'lib/horizon/handler.rb', line 16

def handler(event)
  handlers[event] << lambda { |handler, *args| handler.send event, *args }
end

#handlersObject



8
9
10
# File 'lib/horizon/handler.rb', line 8

def handlers
  @handlers ||= Hash.new { |h, k| h[k] = [] }
end