lib/frenetic/configuration.rb in frenetic-0.0.2.alpha5 vs lib/frenetic/configuration.rb in frenetic-0.0.3

- old
+ new

@@ -12,10 +12,11 @@ config = symbolize_keys config config[:username] = config[:api_key] if config[:api_key] config[:headers] ||= {} config[:request] ||= {} + config[:response] ||= {} config[:headers][:accept] ||= "application/hal+json" # Copy the config into this Configuration instance. config.each { |k, v| self[k] = v } @@ -40,11 +41,11 @@ end end def configure_cache if self[:cache] - ignore_headers = (self[:cache][:ignore_headers] || '').split(' ') + ignore_headers = self[:cache][:ignore_headers] || [] self[:cache][:ignore_headers] = (ignore_headers + %w[Set-Cookie X-Content-Digest]).uniq end end @@ -68,23 +69,16 @@ header_set == custom_headers end # TODO: Is this even being used? def config_file - config_path = File.join( 'config', 'frenetic.yml' ) + path = File.join 'config/frenetic.yml' + config = YAML.load_file( path ) + env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] - if File.exists? config_path - config = YAML.load_file( config_path ) - env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] - - if config and config.has_key? env - config[env] - else - {} - end - else - {} - end + config[env] || {} + rescue Errno::ENOENT, NoMethodError + {} end def symbolize_keys( arg ) case arg when Array \ No newline at end of file