Class: FilterRename::Config

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

Overview

Proxy class for all configurations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global = {}) ⇒ Config

Returns a new instance of Config.



268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/filter_rename/config.rb', line 268

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(Dir.home, ".filter_rename.yaml"), cfg)
  load_file(File.join(Dir.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.



266
267
268
# File 'lib/filter_rename/config.rb', line 266

def filter
  @filter
end

#globalObject (readonly)

Returns the value of attribute global.



266
267
268
# File 'lib/filter_rename/config.rb', line 266

def global
  @global
end

#macroObject (readonly)

Returns the value of attribute macro.



266
267
268
# File 'lib/filter_rename/config.rb', line 266

def macro
  @macro
end

#wordsObject (readonly)

Returns the value of attribute words.



266
267
268
# File 'lib/filter_rename/config.rb', line 266

def words
  @words
end