Class: Apotomo::ProcEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Apotomo::ProcEventHandler
- Defined in:
- lib/apotomo/proc_event_handler.rb
Instance Attribute Summary collapse
-
#proc ⇒ Object
Returns the value of attribute proc.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ ProcEventHandler
constructor
A new instance of ProcEventHandler.
- #process_event(event) ⇒ Object
- #to_s ⇒ Object
Methods inherited from EventHandler
Constructor Details
#initialize(opts = {}) ⇒ ProcEventHandler
Returns a new instance of ProcEventHandler.
5 6 7 |
# File 'lib/apotomo/proc_event_handler.rb', line 5 def initialize(opts={}) @proc = opts.delete(:proc) end |
Instance Attribute Details
#proc ⇒ Object
Returns the value of attribute proc.
3 4 5 |
# File 'lib/apotomo/proc_event_handler.rb', line 3 def proc @proc end |
Instance Method Details
#process_event(event) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/apotomo/proc_event_handler.rb', line 9 def process_event(event) Rails.logger.debug "ProcEventHandler: calling #{@proc}" #@proc.call(event) event.source.controller.send(@proc, event) nil ### DISCUSS: needed so that controller doesn't evaluate the "content". end |
#to_s ⇒ Object
16 |
# File 'lib/apotomo/proc_event_handler.rb', line 16 def to_s; "ProcEventHandler:#{proc}"; end |