Module: Assert::Context::LetDSL
- Included in:
- Assert::Context
- Defined in:
- lib/assert/context/let_dsl.rb
Instance Method Summary collapse
Instance Method Details
#let(name, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/assert/context/let_dsl.rb', line 4 def let(name, &block) self.send(:define_method, name, &-> { if instance_variable_get("@#{name}").nil? instance_variable_set("@#{name}", instance_eval(&block)) end instance_variable_get("@#{name}") }) end |