Class: MrDarcy::Promise::Celluloid
- Defined in:
- lib/mr_darcy/promise/celluloid.rb
Overview
A specialisation of MrDarcy::Promise::Base to work with Celluloid.
See MrDarcy::Promise::Base for method information.
Defined Under Namespace
Classes: Actor
Instance Method Summary collapse
- #final ⇒ Object
-
#initialize(*args) ⇒ Celluloid
constructor
A new instance of Celluloid.
- #reject(value) ⇒ Object
- #resolve(value) ⇒ Object
- #result ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ Celluloid
Returns a new instance of Celluloid.
49 50 51 52 53 54 55 |
# File 'lib/mr_darcy/promise/celluloid.rb', line 49 def initialize *args @complete = false ensure_actor actor.on_success proc { |v| do_resolve v } actor.on_failure proc { |v| do_reject v } super end |
Instance Method Details
#final ⇒ Object
72 73 74 75 |
# File 'lib/mr_darcy/promise/celluloid.rb', line 72 def final wait_until_complete self end |
#reject(value) ⇒ Object
62 63 64 65 |
# File 'lib/mr_darcy/promise/celluloid.rb', line 62 def reject value actor.async.set_status :failure, value self end |
#resolve(value) ⇒ Object
57 58 59 60 |
# File 'lib/mr_darcy/promise/celluloid.rb', line 57 def resolve value actor.async.set_status :success, value self end |
#result ⇒ Object
67 68 69 70 |
# File 'lib/mr_darcy/promise/celluloid.rb', line 67 def result wait_until_complete value end |