Skip to content

Commit

Permalink
ST: Allow hash with indifferent access when loading a config from YAM…
Browse files Browse the repository at this point in the history
…L (in case ActiveSupport is available)
  • Loading branch information
rudionrails committed Nov 27, 2012
1 parent abe4aa4 commit b8be53f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/yell/configuration.rb
Expand Up @@ -10,11 +10,14 @@ module Yell #:nodoc:
class Configuration

def self.load!( file )
# parse through ERB
yaml = ERB.new(File.read(file)).result
yaml = YAML.load( ERB.new(File.read(file)).result )

# parse through YAML
YAML.load(yaml)[Yell.env] || {}
# in case we have ActiveSupport
if yaml.respond_to?( :with_indifference_access )
yaml = yaml.with_indifferent_access
end

yaml[Yell.env] || {}
end

end
Expand Down

0 comments on commit b8be53f

Please sign in to comment.