class Pronto::ConfigFile
Constants
- DEFAULT_MESSAGE_FORMAT
- DEFAULT_WARNINGS_PER_REVIEW
- EMPTY
Attributes
Public Class Methods
Source
# File lib/pronto/config_file.rb, line 45 def initialize(path = ENV.fetch('PRONTO_CONFIG_FILE', '.pronto.yml')) @path = path end
Public Instance Methods
Source
# File lib/pronto/config_file.rb, line 49 def to_h hash = File.exist?(@path) ? YAML.load_file(@path) : {} deep_merge(hash) end
Private Instance Methods
Source
# File lib/pronto/config_file.rb, line 56 def deep_merge(hash) merger = proc do |_, oldval, newval| if oldval.is_a?(Hash) && newval.is_a?(Hash) oldval.merge(newval, &merger) else oldval.nil? ? newval : oldval end end hash.merge(EMPTY, &merger) end