Class: FixtureKit::Configuration
- Inherits:
-
Object
- Object
- FixtureKit::Configuration
- Defined in:
- lib/fixture_kit/configuration.rb
Instance Attribute Summary collapse
-
#adapter_options ⇒ Object
readonly
Returns the value of attribute adapter_options.
-
#cache_path ⇒ Object
Returns the value of attribute cache_path.
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
-
#coders ⇒ Object
readonly
Returns the value of attribute coders.
-
#fixture_path ⇒ Object
Returns the value of attribute fixture_path.
Instance Method Summary collapse
- #adapter(adapter_class = nil, **options) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #on_cache_mount(&block) ⇒ Object
- #on_cache_mounted(&block) ⇒ Object
- #on_cache_save(&block) ⇒ Object
- #on_cache_saved(&block) ⇒ Object
- #register(coder) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 |
# File 'lib/fixture_kit/configuration.rb', line 9 def initialize @fixture_path = "fixture_kit" @cache_path = "tmp/cache/fixture_kit" @adapter_class = MinitestAdapter @adapter_options = {} @callbacks = Callbacks.new @coders = Set.new([ActiveRecordCoder]) end |
Instance Attribute Details
#adapter_options ⇒ Object (readonly)
Returns the value of attribute adapter_options.
7 8 9 |
# File 'lib/fixture_kit/configuration.rb', line 7 def @adapter_options end |
#cache_path ⇒ Object
Returns the value of attribute cache_path.
6 7 8 |
# File 'lib/fixture_kit/configuration.rb', line 6 def cache_path @cache_path end |
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
7 8 9 |
# File 'lib/fixture_kit/configuration.rb', line 7 def callbacks @callbacks end |
#coders ⇒ Object (readonly)
Returns the value of attribute coders.
7 8 9 |
# File 'lib/fixture_kit/configuration.rb', line 7 def coders @coders end |
#fixture_path ⇒ Object
Returns the value of attribute fixture_path.
5 6 7 |
# File 'lib/fixture_kit/configuration.rb', line 5 def fixture_path @fixture_path end |
Instance Method Details
#adapter(adapter_class = nil, **options) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/fixture_kit/configuration.rb', line 22 def adapter(adapter_class = nil, **) return @adapter_class if adapter_class.nil? && .empty? @adapter_class = adapter_class @adapter_options = end |
#on_cache_mount(&block) ⇒ Object
37 38 39 |
# File 'lib/fixture_kit/configuration.rb', line 37 def on_cache_mount(&block) callbacks.register(:cache_mount, &block) end |
#on_cache_mounted(&block) ⇒ Object
41 42 43 |
# File 'lib/fixture_kit/configuration.rb', line 41 def on_cache_mounted(&block) callbacks.register(:cache_mounted, &block) end |
#on_cache_save(&block) ⇒ Object
29 30 31 |
# File 'lib/fixture_kit/configuration.rb', line 29 def on_cache_save(&block) callbacks.register(:cache_save, &block) end |
#on_cache_saved(&block) ⇒ Object
33 34 35 |
# File 'lib/fixture_kit/configuration.rb', line 33 def on_cache_saved(&block) callbacks.register(:cache_saved, &block) end |
#register(coder) ⇒ Object
18 19 20 |
# File 'lib/fixture_kit/configuration.rb', line 18 def register(coder) @coders.add(coder) end |