Class: Q::Callback
- Inherits:
-
Object
- Object
- Q::Callback
- Defined in:
- lib/q/callback.rb
Instance Method Summary collapse
- #call(result) ⇒ Object
-
#initialize(promise, block) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(promise, block) ⇒ Callback
Returns a new instance of Callback.
2 3 4 5 |
# File 'lib/q/callback.rb', line 2 def initialize(promise, block) @promise = promise @block = block end |
Instance Method Details
#call(result) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/q/callback.rb', line 7 def call(result) unless @called @block.call(result) @called = true end end |