Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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