Class: MrDarcy::Deferred
- Inherits:
-
Object
- Object
- MrDarcy::Deferred
- Defined in:
- lib/mr_darcy/deferred.rb
Instance Attribute Summary collapse
-
#last_promise ⇒ Object
Returns the value of attribute last_promise.
-
#promise ⇒ Object
Returns the value of attribute promise.
Instance Method Summary collapse
- #fail(&block) ⇒ Object
-
#initialize(opts = {}, &block) ⇒ Deferred
constructor
A new instance of Deferred.
- #then(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#last_promise ⇒ Object
Returns the value of attribute last_promise.
4 5 6 |
# File 'lib/mr_darcy/deferred.rb', line 4 def last_promise @last_promise end |
#promise ⇒ Object
Returns the value of attribute promise.
4 5 6 |
# File 'lib/mr_darcy/deferred.rb', line 4 def promise @promise end |
Instance Method Details
#fail(&block) ⇒ Object
16 17 18 |
# File 'lib/mr_darcy/deferred.rb', line 16 def fail &block self.last_promise = last_promise.fail(&block) end |
#then(&block) ⇒ Object
12 13 14 |
# File 'lib/mr_darcy/deferred.rb', line 12 def then &block self.last_promise = last_promise.then(&block) end |