Class: Apotomo::ProcEventHandler

Inherits:
EventHandler show all
Defined in:
lib/apotomo/proc_event_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from EventHandler

#==, #call

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

#procObject

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_sObject



16
# File 'lib/apotomo/proc_event_handler.rb', line 16

def to_s; "ProcEventHandler:#{proc}"; end