Module: Hydra::GlobalConfigurable
- Included in:
- Hydra
- Defined in:
- lib/hydra/global_configurable.rb
Instance Method Summary collapse
-
#config ⇒ Object
(also: #blacklight_config)
The main config accessor.
-
#configs ⇒ Object
A hash of all environment configs The key is the environment name, the value a Hash.
-
#configure(env = :shared) {|| ... } ⇒ Object
Accepts a value for the environment to configure and a block A hash is yielded to the block If the “env” != :shared, the hash is created by deep cloning the :shared environment config.
-
#reset_configs! ⇒ Object
sets the @configs variable to a new Hash with empty Hash for :shared key and @config to nil.
Instance Method Details
#config ⇒ Object Also known as: blacklight_config
32 33 34 |
# File 'lib/hydra/global_configurable.rb', line 32 def config @config ||= configs[:shared].merge(configs[::Rails.env] ||= {}) end |
#configs ⇒ Object
A hash of all environment configs The key is the environment name, the value a Hash
26 27 28 |
# File 'lib/hydra/global_configurable.rb', line 26 def configs @configs ? @configs : (reset_configs! and @configs) end |
#configure(env = :shared) {|| ... } ⇒ Object
Accepts a value for the environment to configure and a block A hash is yielded to the block If the “env” != :shared, the hash is created by deep cloning the :shared environment config. This makes it possible to create defaults in the :shared config
42 43 44 45 |
# File 'lib/hydra/global_configurable.rb', line 42 def configure(env = :shared, &blk) configs[env] = {} yield configs[env] end |
#reset_configs! ⇒ Object
sets the @configs variable to a new Hash with empty Hash for :shared key and @config to nil
19 20 21 22 |
# File 'lib/hydra/global_configurable.rb', line 19 def reset_configs! @config = nil @configs = {:shared=>{}} end |