Method: Wms::Config::Mixin::MixinClassMethod#source
- Defined in:
- lib/wms/config/mixin.rb
#source(filename, options = {}) ⇒ Object
This is the main point of entry - we call Settings.load! and provide a name of the file to read as it’s argument. We can also pass in some options, but at the moment it’s being used to allow per-environment overrides in Rails
Example Load without environment
> Settings.load!(“config/appdata/example.yml”)
Load with environment
> Settings.load!(
"#{Rails.root}/config/appdata/env-example.yml",
:env => Rails.env)
99 100 101 102 103 104 105 106 |
# File 'lib/wms/config/mixin.rb', line 99 def source(filename, ={}) newsets = YAML::load_file(filename).deep_symbolize_keys newsets = newsets[[:env].to_sym] if \ [:env] && \ newsets[[:env].to_sym] @default ||= Hash.new deep_merge!(@default, newsets) end |