Class: TCOMethod::BlockWithTCO
- Inherits:
-
Object
- Object
- TCOMethod::BlockWithTCO
- Defined in:
- lib/tco_method/block_with_tco.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(&block) ⇒ BlockWithTCO
constructor
A new instance of BlockWithTCO.
Constructor Details
#initialize(&block) ⇒ BlockWithTCO
Returns a new instance of BlockWithTCO.
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
#result ⇒ Object (readonly)
Returns the value of attribute result.
5 6 7 |
# File 'lib/tco_method/block_with_tco.rb', line 5 def result @result end |