Class: Synthra::Scenarios::LazyFixture

Inherits:
Object
  • Object
show all
Defined in:
lib/synthra/scenarios.rb

Overview

A lazy fixture that evaluates on first access

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#blockObject (readonly)

Returns the value of attribute block.



272
273
274
# File 'lib/synthra/scenarios.rb', line 272

def block
  @block
end

#nameObject (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