Class: FixtureKit::Runner
- Inherits:
-
Object
- Object
- FixtureKit::Runner
- Defined in:
- lib/fixture_kit/runner.rb
Constant Summary collapse
- PRESERVE_CACHE_ENV_KEY =
"FIXTURE_KIT_PRESERVE_CACHE"
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
- #adapter ⇒ Object
- #coders ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #register(name_or_definition, scope) ⇒ Object
- #start ⇒ Object
- #started? ⇒ Boolean
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 16 |
# File 'lib/fixture_kit/runner.rb', line 11 def initialize @configuration = Configuration.new @registry = Registry.new @adapter = nil @started = false end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
9 10 11 |
# File 'lib/fixture_kit/runner.rb', line 9 def configuration @configuration end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
9 10 11 |
# File 'lib/fixture_kit/runner.rb', line 9 def registry @registry end |
Instance Method Details
#adapter ⇒ Object
31 32 33 |
# File 'lib/fixture_kit/runner.rb', line 31 def adapter @adapter ||= configuration.adapter.new(configuration.) end |
#coders ⇒ Object
35 36 37 |
# File 'lib/fixture_kit/runner.rb', line 35 def coders @coders ||= configuration.coders.map(&:new) end |
#register(name_or_definition, scope) ⇒ Object
18 19 20 21 22 |
# File 'lib/fixture_kit/runner.rb', line 18 def register(name_or_definition, scope) fixture = registry.add(name_or_definition, scope) configuration.callbacks.run(:register, Event.new(fixture), scope) fixture end |
#start ⇒ Object
24 25 26 27 28 29 |
# File 'lib/fixture_kit/runner.rb', line 24 def start raise RunnerAlreadyStartedError, "FixtureKit::Runner has already been started" if started? @started = true clear_cache unless preserve_cache? end |
#started? ⇒ Boolean
39 40 41 |
# File 'lib/fixture_kit/runner.rb', line 39 def started? @started end |