Class: Omamori::Config
- Inherits:
-
Object
- Object
- Omamori::Config
- Defined in:
- lib/omamori/config.rb
Constant Summary collapse
- DEFAULT_CONFIG_PATH =
".omamorirc"
Instance Method Summary collapse
- #get(key, default = nil) ⇒ Object
-
#initialize(config_path = DEFAULT_CONFIG_PATH) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(config_path = DEFAULT_CONFIG_PATH) ⇒ Config
Returns a new instance of Config.
9 10 11 12 13 |
# File 'lib/omamori/config.rb', line 9 def initialize(config_path = DEFAULT_CONFIG_PATH) @config_path = config_path @config = load_config validate_config # Add validation after loading end |
Instance Method Details
#get(key, default = nil) ⇒ Object
15 16 17 |
# File 'lib/omamori/config.rb', line 15 def get(key, default = nil) @config.fetch(key.to_s, default) end |