Sha256: d56f21eba80e0c9237ce49d547eef42e267e4d049626d9771ddeea8b34d440eb
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
module Controll module Enabler module Notify extend ActiveSupport::Concern included do Controll::Event.valid_types.each do |type| meth = "create_#{type}" define_method meth do |*args| return create_event type, type if args.empty? create_event args.first, type, args[1..-1] end alias_method type, meth end end include Controll::Event::Helper def notify event, *args events << normalize(event, *args) self # enable method chaining on controller end # event stack def events @events ||= Controll::Events.new end def main_event events.last || create_success end protected def process_events notifier = nil notifier ||= self.notifier events.each do |event| notifier.send(event.type).notify event.name, event.options end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
controll-0.3.2 | lib/controll/enabler/notify.rb |
controll-0.3.1 | lib/controll/enabler/notify.rb |
controll-0.3.0 | lib/controll/enabler/notify.rb |