Class: Timberline::Config
- Inherits:
-
Object
- Object
- Timberline::Config
- Defined in:
- lib/timberline-rails.rb
Overview
Re-open the Timberline::Config class from Timberline
Instance Method Summary collapse
-
#rails_initialize ⇒ Object
(also: #initialize)
Load config/timberline.yml from the Rails root if it exists.
Instance Method Details
#rails_initialize ⇒ Object Also known as: initialize
Load config/timberline.yml from the Rails root if it exists. If it doesn’t, or if we’re somehow not in a Rails application, just use the default Timberline behavior for instantiating Config objects.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/timberline-rails.rb', line 16 def rails_initialize if defined? ::Rails config_file = File.join(::Rails.root, 'config', 'timberline.yml') if File.exists?(config_file) configs = YAML.load_file(config_file) config = configs[::Rails.env] load_from_yaml(config) else non_rails_initialize end else non_rails_initialize end end |