Class: Laborantin::Metaprog::Resolutions::Resolution

Inherits:
Object
  • Object
show all
Defined in:
lib/laborantin/core/resolutions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &blk) ⇒ Resolution

Returns a new instance of Resolution.



27
28
29
30
# File 'lib/laborantin/core/resolutions.rb', line 27

def initialize(name, &blk)
  @name = name
  @block = blk
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



26
27
28
# File 'lib/laborantin/core/resolutions.rb', line 26

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



26
27
28
# File 'lib/laborantin/core/resolutions.rb', line 26

def name
  @name
end

Instance Method Details

#resolve!(*ary) ⇒ Object

Raises:

  • (RuntimeError)


32
33
34
35
# File 'lib/laborantin/core/resolutions.rb', line 32

def resolve!(*ary)
  raise RuntimeError, "no block to resolve #{self}" unless block
  block.call(*ary)
end