Skip to content

Instantly share code, notes, and snippets.

@kivanio
Forked from carlosantoniodasilva/config.rb
Created September 18, 2011 22:33
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 kivanio/1225644 to your computer and use it in GitHub Desktop.
Save kivanio/1225644 to your computer and use it in GitHub Desktop.
Simple config class
## Simple config class - testing purposes =)
FooConfig = Class.new do
def initialize(config_file, env)
@config = YAML.load_file(config_file)[env]
end
def method_missing(method, *args)
@config.send(:[], method.to_s, *args)
end
end.new('config/foo.yml', Rails.env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment