lib/signal.rb in signal-0.1.1 vs lib/signal.rb in signal-0.2.0
- old
+ new
@@ -1,8 +1,8 @@
-require "signal/active_record"
-require "signal/listener"
-require "signal/version"
+require 'signal/active_record'
+require 'signal/listener'
+require 'signal/version'
module Signal
def on(event, &block)
listeners << Listener.new(self, __method__, event, &block)
self
@@ -13,9 +13,14 @@
self
end
def after(event, &block)
listeners << Listener.new(self, __method__, event, &block)
+ self
+ end
+
+ def add_listener(listener)
+ listeners << listener
self
end
def emit(event, *args)
emit_signal(:before, event, *args)