Class: Test::Unit::TestCase
- Inherits:
-
Object
- Object
- Test::Unit::TestCase
- Defined in:
- lib/let-unit.rb
Class Method Summary collapse
Class Method Details
.let(x, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/let-unit.rb', line 4 def self.let(x, &block) define_method x do ivar_key = "@___#{x}" unless instance_variable_defined?(ivar_key) value = yield block instance_variable_set(ivar_key, value) end instance_variable_get(ivar_key) end end |