class RepoCompare::Config
Load configuration
Constants
- CONFIG_PATH
Public Class Methods
new()
click to toggle source
# File lib/repo-compare/config.rb, line 10 def initialize @config = File.exist?(CONFIG_PATH) ? YAML.load_file(CONFIG_PATH) : {} @config['paths'] ||= [] @config['ignore'] ||= {} @config['source_branch'] ||= 'master' end
Public Instance Methods
to_h()
click to toggle source
# File lib/repo-compare/config.rb, line 17 def to_h @config.to_h end
update(results)
click to toggle source
# File lib/repo-compare/config.rb, line 21 def update(results) results.each do |result| @config['ignore'][result[:src]] ||= {} update_conf_path(@config['ignore'][result[:src]], result[:results]) end File.open(CONFIG_PATH, 'w') { |f| f.puts(@config.to_yaml) } end
Private Instance Methods
update_conf_path(conf, results)
click to toggle source
# File lib/repo-compare/config.rb, line 31 def update_conf_path(conf, results) results.each do |path, hash| conf[path] = hash end end