Class: Dhall::Util::LazyPromise

Inherits:
Promise
  • Object
show all
Defined in:
lib/dhall/util.rb

Instance Method Summary collapse

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