summaryrefslogtreecommitdiffstats
path: root/test/lib/spec/callback/extensions
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-08-23 01:17:33 -0500
committerLuke Kanies <luke@madstop.com>2007-08-23 01:17:33 -0500
commitd59315a07a8a01ca65952d8e8fe9d2f1bb84d30e (patch)
tree8e2470f271c8c6e622f0aef3fd5a2f01502d8305 /test/lib/spec/callback/extensions
parent5601ecf75d3854a66d087a108e1b06885fa2be12 (diff)
Adding the second half of the rspec upgrade -- apparently the "git add" thing I used did not remove the old files, only add the new ones.
Diffstat (limited to 'test/lib/spec/callback/extensions')
-rw-r--r--test/lib/spec/callback/extensions/module.rb24
-rw-r--r--test/lib/spec/callback/extensions/object.rb37
2 files changed, 0 insertions, 61 deletions
diff --git a/test/lib/spec/callback/extensions/module.rb b/test/lib/spec/callback/extensions/module.rb
deleted file mode 100644
index 429268ed1..000000000
--- a/test/lib/spec/callback/extensions/module.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-module Callback
- module ModuleMethods
- # For each event_name submitted, defines a callback event with this name.
- # Client code can then register as a callback listener using object.event_name.
- def callback_events(*event_names)
- event_names.each do |event_name|
- define_callback_event(event_name)
- end
- end
-
- private
- def define_callback_event(event_name)
- module_eval <<-EOS
- def #{event_name}(&block)
- register_callback(:#{event_name}, &block)
- end
- EOS
- end
- end
-end
-
-class Module
- include Callback::ModuleMethods
-end
diff --git a/test/lib/spec/callback/extensions/object.rb b/test/lib/spec/callback/extensions/object.rb
deleted file mode 100644
index c6ac6fd14..000000000
--- a/test/lib/spec/callback/extensions/object.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-module Callback
- module InstanceMethods
- # Registers a callback for the event on the object. The callback can either be a block or a proc.
- # When the callbacks are notified, the return value of the proc is passed to the caller.
- def register_callback(event, callback_proc=nil, &callback_block)
- callbacks.define(event, callback_proc, &callback_block)
- end
-
- # Removes the callback from the event. The callback proc must be the same
- # object as the one that was passed to register_callback.
- def unregister_callback(event, callback_proc)
- callbacks.undefine(event, callback_proc)
- end
-
- protected
- # Notifies the callbacks registered with the event on the object. Arguments can be passed to the callbacks.
- # An error handler may be passed in as a block. If there is an error, the block is called with
- # error object as an argument.
- # An array of the return values of the callbacks is returned.
- def notify_callbacks(event, *args, &error_handler)
- callbacks.notify(event, *args, &error_handler)
- end
-
- def notify_class_callbacks(event, *args, &error_handler)
- self.class.send(:notify_callbacks, event, *args, &error_handler)
- end
-
- # The CallbackContainer for this object.
- def callbacks
- @callbacks ||= CallbackContainer.new
- end
- end
-end
-
-class Object
- include Callback::InstanceMethods
-end \ No newline at end of file