Class: Visionary::Promise
- Inherits:
-
Object
- Object
- Visionary::Promise
- Defined in:
- lib/visionary/promise.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.setup! ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/visionary/promise.rb', line 5 def setup! unless setted_up Kernel.send :define_method, :promise do Promise.new end self.setted_up = true end end |
Instance Method Details
#complete(computed_value) ⇒ Object
23 24 25 26 |
# File 'lib/visionary/promise.rb', line 23 def complete(computed_value) future.instance_eval { complete_with(computed_value) } freeze end |
#fail(provided_error) ⇒ Object
28 29 30 31 |
# File 'lib/visionary/promise.rb', line 28 def fail(provided_error) future.instance_eval { fail_with(provided_error) } freeze end |