Module: EnvConfig
- Extended by:
- EnvConfig
- Included in:
- EnvConfig
- Defined in:
- lib/env_config.rb,
lib/env_config/config.rb,
lib/env_config/railtie.rb,
lib/env_config/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Attribute Summary collapse
-
#config ⇒ Object
EnvConfig::Config object.
Instance Method Summary collapse
-
#configure {|@config| ... } ⇒ Object
Creates a new EnvConfig::Config object and yields to block returns config object.
-
#set!(options = {}) ⇒ Object
After #configure, this method sets all scoped variables into environment variables.
Instance Attribute Details
#config ⇒ Object
EnvConfig::Config object
12 13 14 |
# File 'lib/env_config.rb', line 12 def config @config end |
Instance Method Details
#configure {|@config| ... } ⇒ Object
Creates a new EnvConfig::Config object and yields to block returns config object
16 17 18 19 20 |
# File 'lib/env_config.rb', line 16 def configure @config ||= Config.new yield @config if block_given? @config end |
#set!(options = {}) ⇒ Object
After #configure, this method sets all scoped variables into environment variables
24 25 26 27 28 29 30 31 |
# File 'lib/env_config.rb', line 24 def set!( = {}) [:scoped] ||= find_scoped_config [:config] ||= @config [:scoped].each do |key, value| ENV[key] = value if config.override_env ENV[key] ||= value end end |