Skip to content

Instantly share code, notes, and snippets.

@makoto
Created November 9, 2009 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makoto/229861 to your computer and use it in GitHub Desktop.
Save makoto/229861 to your computer and use it in GitHub Desktop.
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