Module: Blacklight::Configurable
- Included in:
- Blacklight
- Defined in:
- vendor/plugins/blacklight/lib/blacklight/configurable.rb
Instance Method Summary (collapse)
-
- (Object) config
The main config accessor.
-
- (Object) configs
A hash of all environment configs The key is the environment name, the value a Hash.
-
- (Object) configure(env = :shared) {|configs[env]| ... }
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.
-
- (Object) reset_configs!
sets the @configs variable to a new Hash with empty Hash for :shared key and @config to nil.
Instance Method Details
- (Object) config
The main config accessor. It merges the current configs[RAILS_ENV] with configs[:shared] and lazy-loads @config to the result.
32 33 34 |
# File 'vendor/plugins/blacklight/lib/blacklight/configurable.rb', line 32 def config @config ||= configs[:shared].merge(configs[RAILS_ENV] ||= {}) end |
- (Object) configs
A hash of all environment configs The key is the environment name, the value a Hash
26 27 28 |
# File 'vendor/plugins/blacklight/lib/blacklight/configurable.rb', line 26 def configs @configs ? @configs : (reset_configs! and @configs) end |
- (Object) configure(env = :shared) {|configs[env]| ... }
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
41 42 43 44 |
# File 'vendor/plugins/blacklight/lib/blacklight/configurable.rb', line 41 def configure(env = :shared, &blk) configs[env] = {} yield configs[env] end |
- (Object) reset_configs!
sets the @configs variable to a new Hash with empty Hash for :shared key and @config to nil
19 20 21 22 |
# File 'vendor/plugins/blacklight/lib/blacklight/configurable.rb', line 19 def reset_configs! @config = nil @configs = {:shared=>{}} end |