Module: Maxitest::LetAll
- Defined in:
- lib/maxitest/let_all.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
13 14 15 |
# File 'lib/maxitest/let_all.rb', line 13 def self.included(base) base.extend(self) end |
Instance Method Details
#let_all(name, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/maxitest/let_all.rb', line 3 def let_all(name, &block) cache = [] define_method(name) do if cache.empty? cache << instance_eval(&block) end cache.first end end |