Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created October 24, 2011 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lytol/1309363 to your computer and use it in GitHub Desktop.
Save Lytol/1309363 to your computer and use it in GitHub Desktop.
require 'yaml'
module MyRailsApp
module Config
extend self
def [](key)
hash[key.to_sym]
end
def hash
@hash ||= YAML.load(IO.read(Rails.root + "config/application.yml"))[Rails.env.to_s].symbolize_keys
end
def method_missing(method, *args)
if hash.has_key?(method.to_sym)
hash[method.to_sym]
else
super
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment