Class: Ynl::Models::Thunk

Inherits:
Object
  • Object
show all
Defined in:
ynl/lib/ynl/models.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Thunk

Returns a new instance of Thunk.



21
22
23
# File 'ynl/lib/ynl/models.rb', line 21

def initialize(&block)
  @block = block
end

Instance Method Details

#resolve(f) ⇒ Object

Raises:



25
26
27
28
29
# File 'ynl/lib/ynl/models.rb', line 25

def resolve(f)
  raise ParseError, "Circular dependency" if @resolving
  @resolving = true
  @block.call(f)
end