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
29 30 31 |
# File 'lib/fixture_kit/runner.rb', line 29 def adapter @adapter ||= configuration.adapter.new(configuration.) end |
#coders ⇒ Object
33 34 35 |
# File 'lib/fixture_kit/runner.rb', line 33 def coders @coders ||= configuration.coders.map(&:new) end |
#register(name_or_definition, scope) ⇒ Object
18 19 20 |
# File 'lib/fixture_kit/runner.rb', line 18 def register(name_or_definition, scope) registry.add(name_or_definition, scope) end |
#start ⇒ Object
22 23 24 25 26 27 |
# File 'lib/fixture_kit/runner.rb', line 22 def start raise RunnerAlreadyStartedError, "FixtureKit::Runner has already been started" if started? @started = true clear_cache unless preserve_cache? end |
#started? ⇒ Boolean
37 38 39 |
# File 'lib/fixture_kit/runner.rb', line 37 def started? @started end |