Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment