summaryrefslogtreecommitdiffstats
path: root/test/lib/spec/callback/extensions/object.rb
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/object.rb
parent5601ecf75d3854a66d087a108e1b06885fa2be12 (diff)
downloadpuppet-d59315a07a8a01ca65952d8e8fe9d2f1bb84d30e.tar.gz
puppet-d59315a07a8a01ca65952d8e8fe9d2f1bb84d30e.tar.xz
puppet-d59315a07a8a01ca65952d8e8fe9d2f1bb84d30e.zip
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/object.rb')
-rw-r--r--test/lib/spec/callback/extensions/object.rb37
1 files changed, 0 insertions, 37 deletions
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