Class: Omc::Config
- Inherits:
-
Object
- Object
- Omc::Config
- Defined in:
- lib/omc/config.rb
Constant Summary collapse
- PATHS =
[ File.join(ENV['HOME'], '.config', 'omcrc'), File.join(ENV['HOME'], '.omcrc'), '.omcrc' ]
Class Method Summary collapse
Instance Method Summary collapse
- #account ⇒ Object
-
#initialize(config = {}) ⇒ Config
constructor
A new instance of Config.
- #load_file(path) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Config
Returns a new instance of Config.
23 24 25 |
# File 'lib/omc/config.rb', line 23 def initialize(config={}) @config = config end |
Class Method Details
.load ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/omc/config.rb', line 10 def self.load config = new PATHS.each do |path| config.load_file(path) end config end |
Instance Method Details
#account ⇒ Object
27 28 29 |
# File 'lib/omc/config.rb', line 27 def account @config['account'] end |
#load_file(path) ⇒ Object
18 19 20 21 |
# File 'lib/omc/config.rb', line 18 def load_file path return unless File.exists?(path) @config.update TOML.load_file(path) end |