Created
September 11, 2011 14:22
-
-
Save chsh/1209646 to your computer and use it in GitHub Desktop.
Load Rails related configuration from yaml file with erb evaluation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'erb' | |
class ConfigLoader | |
def self.from(yaml) | |
yaml = File.read(yaml) if File.exist?(yaml) | |
YAML.load(ERB.new(yaml).result)[Rails.env] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment