Created
November 9, 2009 10:30
-
-
Save makoto/229861 to your computer and use it in GitHub Desktop.
This file contains 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 'YAML' | |
# Retains as a constant | |
CONFIG = YAML.load_file('config.yml') | |
# or | |
# Retains as an instance variable. | |
class Config | |
def initialize(name) | |
@config = get_from_disk(name) | |
end | |
def get | |
@config | |
end | |
private | |
def get_from_disk(name) | |
YAML.load_file(name) | |
end | |
end | |
config = Config.new('config.yml') | |
config.get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment