Class: Omamori::Config
- Inherits:
-
Object
- Object
- Omamori::Config
- Defined in:
- lib/omamori/config.rb
Constant Summary collapse
- DEFAULT_CONFIG_PATH =
".omamorirc"
- DEFAULT_IGNORE_PATH =
".omamoriignore"
Instance Attribute Summary collapse
-
#ignore_patterns ⇒ Object
readonly
Returns the value of attribute ignore_patterns.
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.
12 13 14 15 16 17 |
# File 'lib/omamori/config.rb', line 12 def initialize(config_path = DEFAULT_CONFIG_PATH) @config_path = config_path @config = load_config @ignore_patterns = load_ignore_patterns # Load ignore patterns validate_config # Add validation after loading end |
Instance Attribute Details
#ignore_patterns ⇒ Object (readonly)
Returns the value of attribute ignore_patterns.
10 11 12 |
# File 'lib/omamori/config.rb', line 10 def ignore_patterns @ignore_patterns end |
Instance Method Details
#get(key, default = nil) ⇒ Object
19 20 21 |
# File 'lib/omamori/config.rb', line 19 def get(key, default = nil) @config.fetch(key.to_s, default) end |