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

- (ProcEventHandler) initialize(opts = {})

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

- (Object) proc

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

- (Object) process_event(event)



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

- (Object) to_s



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

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