Module: Minestrone::Configuration::Loading::ClassMethods
- Defined in:
- lib/minestrone/configuration/loading.rb
Instance Attribute Summary collapse
-
#current_feature ⇒ Object
Used internally to specify the current file being required, so that any recipes loaded by that file can be remembered.
Instance Method Summary collapse
-
#instance(require_config = false) ⇒ Object
Used by third-party task bundles to identify the minestrone configuration that is loading them.
-
#instance=(config) ⇒ Object
Used internally by Minestrone to specify the current configuration before loading a third-party task bundle.
-
#recipes_per_feature ⇒ Object
Used internally by Minestrone to track which recipes have been loaded via require, so that they may be successfully reloaded when require is called again.
Instance Attribute Details
#current_feature ⇒ Object
Used internally to specify the current file being required, so that any recipes loaded by that file can be remembered. This allows recipes loaded via require to be correctly reloaded in different Configuration instances in the same Ruby instance.
47 48 49 |
# File 'lib/minestrone/configuration/loading.rb', line 47 def current_feature @current_feature end |
Instance Method Details
#instance(require_config = false) ⇒ Object
Used by third-party task bundles to identify the minestrone configuration that is loading them. Its return value is not reliable in other contexts. If require_config is not false, an exception will be raised if the current configuration is not set.
17 18 19 20 21 22 23 24 25 |
# File 'lib/minestrone/configuration/loading.rb', line 17 def instance(require_config = false) config = @instance if require_config && config.nil? raise LoadError, "Please require this file from within a Minestrone recipe" end config end |
#instance=(config) ⇒ Object
Used internally by Minestrone to specify the current configuration before loading a third-party task bundle.
30 31 32 |
# File 'lib/minestrone/configuration/loading.rb', line 30 def instance=(config) @instance = config end |
#recipes_per_feature ⇒ Object
Used internally by Minestrone to track which recipes have been loaded via require, so that they may be successfully reloaded when require is called again.
38 39 40 |
# File 'lib/minestrone/configuration/loading.rb', line 38 def recipes_per_feature @recipes_per_feature ||= {} end |