lib/waffle/config.rb in waffle-0.3.4 vs lib/waffle/config.rb in waffle-0.3.5

- old
+ new

@@ -8,18 +8,25 @@ attr_reader :config_hash def initialize @config_hash = {'transport' => 'rabbitmq', 'url' => nil, 'encoder' => 'json'} + filename = "config/waffle.yml" + if defined? Rails - if File.exists? "#{Rails.root}/config/waffle.yml" - loaded_config = YAML.load_file("#{Rails.root}/config/waffle.yml") + fielname = "#{Rails.root}/config/waffle.yml" + end - if loaded_config[Rails.env] - @config_hash.merge! loaded_config[Rails.env] - end + if File.exists?(filename) + loaded_config = YAML.load_file filename + + if defined?(Rails) && loaded_config[Rails.env] + @config_hash.merge! loaded_config[Rails.env] + else + @config_hash.merge! loaded_config end end + end class << self def method_missing(m, *args, &block)