Class: Dhall::Util::LazyPromise
- Inherits:
-
Promise
- Object
- Promise
- Dhall::Util::LazyPromise
- Defined in:
- lib/dhall/util.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ LazyPromise
constructor
A new instance of LazyPromise.
- #subscribe(*args) ⇒ Object
Constructor Details
#initialize(&block) ⇒ LazyPromise
Returns a new instance of LazyPromise.
9 10 11 12 |
# File 'lib/dhall/util.rb', line 9 def initialize(&block) super @block = block end |
Instance Method Details
#subscribe(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/dhall/util.rb', line 14 def subscribe(*args) super begin fulfill(@block.call) rescue => e reject(e) end end |