Class: Synthra::Scenarios::LazyFixture
- Inherits:
-
Object
- Object
- Synthra::Scenarios::LazyFixture
- Defined in:
- lib/synthra/scenarios.rb
Overview
A lazy fixture that evaluates on first access
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build(context) ⇒ Object
-
#initialize(name, &block) ⇒ LazyFixture
constructor
A new instance of LazyFixture.
Constructor Details
#initialize(name, &block) ⇒ LazyFixture
Returns a new instance of LazyFixture.
274 275 276 277 |
# File 'lib/synthra/scenarios.rb', line 274 def initialize(name, &block) @name = name @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
272 273 274 |
# File 'lib/synthra/scenarios.rb', line 272 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
272 273 274 |
# File 'lib/synthra/scenarios.rb', line 272 def name @name end |
Instance Method Details
#build(context) ⇒ Object
279 280 281 |
# File 'lib/synthra/scenarios.rb', line 279 def build(context) context.instance_eval(&@block) end |