Class: FilterRename::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global = {}) ⇒ Config

Returns a new instance of Config.



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/filter_rename/config.rb', line 92

def initialize(global = {})
  cfg = {filter: {}, global: {}, macro: {}, words: {}}

  load_file(File.expand_path(File.join(File.dirname(__FILE__), '..', 'filter_rename.yaml')), cfg)
  load_file(File.join(ENV['HOME'], '.filter_rename.yaml'), cfg)
  load_file(File.join(ENV['HOME'], '.filter_rename', 'config.yaml'), cfg)

  @filter = FilterConfig.new(cfg[:filter])
  @global = GlobalConfig.new(cfg[:global].merge(global))
  @macro  = MacroConfig.new(cfg[:macro].sort)
  @words  = WordsConfig.new(cfg[:words].sort)
end

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



90
91
92
# File 'lib/filter_rename/config.rb', line 90

def filter
  @filter
end

#globalObject (readonly)

Returns the value of attribute global.



90
91
92
# File 'lib/filter_rename/config.rb', line 90

def global
  @global
end

#macroObject (readonly)

Returns the value of attribute macro.



90
91
92
# File 'lib/filter_rename/config.rb', line 90

def macro
  @macro
end

#wordsObject (readonly)

Returns the value of attribute words.



90
91
92
# File 'lib/filter_rename/config.rb', line 90

def words
  @words
end