Class: TCOMethod::BlockWithTCO

Inherits:
Object
  • Object
show all
Defined in:
lib/tco_method/block_with_tco.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ BlockWithTCO

Returns a new instance of BlockWithTCO.

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/tco_method/block_with_tco.rb', line 7

def initialize(&block)
  raise ArgumentError, "Block required" unless block
  @result = eval(block)
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



5
6
7
# File 'lib/tco_method/block_with_tco.rb', line 5

def result
  @result
end