Class: ZookeeperCallbacks::Callback
- Inherits:
-
Object
- Object
- ZookeeperCallbacks::Callback
- Defined in:
- lib/zookeeper/callbacks.rb
Direct Known Subclasses
ACLCallback, DataCallback, StatCallback, StringCallback, StringsCallback, VoidCallback, WatcherCallback
Instance Attribute Summary (collapse)
-
- (Object) completed
readonly
Returns the value of attribute completed.
-
- (Object) context
readonly
Returns the value of attribute context.
-
- (Object) proc
readonly
Returns the value of attribute proc.
Instance Method Summary (collapse)
- - (Object) call(*args)
- - (Boolean) completed?
-
- (Callback) initialize
constructor
A new instance of Callback.
- - (Object) initialize_context(hash)
Constructor Details
- (Callback) initialize
A new instance of Callback
5 6 7 8 9 10 11 12 |
# File 'lib/zookeeper/callbacks.rb', line 5 def initialize @completed = false @proc = Proc.new do |hash| initialize_context(hash) yield if block_given? @completed = true end end |
Instance Attribute Details
- (Object) completed (readonly)
Returns the value of attribute completed
3 4 5 |
# File 'lib/zookeeper/callbacks.rb', line 3 def completed @completed end |
- (Object) context (readonly)
Returns the value of attribute context
3 4 5 |
# File 'lib/zookeeper/callbacks.rb', line 3 def context @context end |
- (Object) proc (readonly)
Returns the value of attribute proc
3 4 5 |
# File 'lib/zookeeper/callbacks.rb', line 3 def proc @proc end |
Instance Method Details
- (Object) call(*args)
14 15 16 17 |
# File 'lib/zookeeper/callbacks.rb', line 14 def call(*args) # puts "call passed #{args.inspect}" @proc.call(*args) end |
- (Boolean) completed?
19 20 21 |
# File 'lib/zookeeper/callbacks.rb', line 19 def completed? @completed end |
- (Object) initialize_context(hash)
23 24 25 |
# File 'lib/zookeeper/callbacks.rb', line 23 def initialize_context(hash) @context = nil end |