Class: Omamori::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/omamori/config.rb

Constant Summary collapse

DEFAULT_CONFIG_PATH =
".omamorirc"
DEFAULT_IGNORE_PATH =
".omamoriignore"

Instance Attribute Summary collapse

Instance Method Summary collapse

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_patternsObject (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