Module: HaystackRuby::Config
Instance Attribute Summary collapse
-
#projects ⇒ Object
Returns the value of attribute projects.
Instance Method Summary collapse
-
#load!(path, environment = nil) ⇒ Object
called in railtie.
- #load_configuration(conf) ⇒ Object
Instance Attribute Details
#projects ⇒ Object
Returns the value of attribute projects.
4 5 6 |
# File 'lib/haystack_ruby/config.rb', line 4 def projects @projects end |
Instance Method Details
#load!(path, environment = nil) ⇒ Object
called in railtie
15 16 17 18 19 20 |
# File 'lib/haystack_ruby/config.rb', line 15 def load!(path, environment = nil) require 'yaml' environment ||= Rails.env conf = YAML.load(File.new(path).read).with_indifferent_access[environment] load_configuration(conf) end |
#load_configuration(conf) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/haystack_ruby/config.rb', line 6 def load_configuration conf @projects = {} conf.each do |name, config| p = Project.new(name, config) @projects[name] = p if p.valid? end end |