Skip to content

Instantly share code, notes, and snippets.

@bricker
Created August 1, 2014 04:59
Show Gist options
  • Select an option

  • Save bricker/4a1856591ead0b0bee00 to your computer and use it in GitHub Desktop.

Select an option

Save bricker/4a1856591ead0b0bee00 to your computer and use it in GitHub Desktop.
require 'yaml'
module Mailbosa
class Settings
Path = [
'/home/renich/Projects/ruby/mailbosa/usr/local/etc/mailbosa/settings.yml',
'/home/renich/Projects/ruby/mailbosa/etc/mailbosa/settings.yml'
]
def initialize
file = Path.select { |path| File.exists? path }
@settings = self.read( file.first )
end
def read( file )
YAML.load_file( file ).to_hash
end
def [](key)
@settings[key]
end
end
end
s = Mailbosa::Settings.new
p s[:key]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment