Module: ZK::Extensions::Callbacks::Callback::ClassMethods
- Defined in:
- lib/z_k/extensions.rb
Instance Method Summary collapse
-
#create(*args, &block) ⇒ Object
allows for easier construction of a user callback block that will be called with the callback object itself as an argument.
Instance Method Details
#create(*args, &block) ⇒ Object
allows for easier construction of a user callback block that will be called with the callback object itself as an argument.
*args, if given, will be passed on after the callback
example:
WatcherCallback.create do |cb|
puts "watcher callback called with argument: #{cb.inspect}"
end
"watcher callback called with argument: #<ZookeeperCallbacks::WatcherCallback:0x1018a3958 @state=3, @type=1, ...>"
29 30 31 32 |
# File 'lib/z_k/extensions.rb', line 29 def create(*args, &block) # honestly, i have no idea how this could *possibly* work, but it does... cb_inst = new { block.call(cb_inst) } end |