Sha256: ff5e4a6624bd90945182212ba8807793ec38442ffdf8d67c79909d8ff2de7de4

Contents?: true

Size: 473 Bytes

Versions: 22

Compression:

Stored size: 473 Bytes

Contents

module Apotomo
  class ProcEventHandler < EventHandler
    attr_accessor :proc
    
    def initialize(opts={})
      @proc = opts.delete(:proc)
    end
    
    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
    
    def to_s; "ProcEventHandler:#{proc}"; end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
apotomo-0.1.2 lib/apotomo/proc_event_handler.rb
apotomo-0.1.1 lib/apotomo/proc_event_handler.rb