Class: Poper2::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/poper2/config_file.rb

Constant Summary collapse

EMPTY =
{
  'disallow_single_word' => {
    'enabled' => true
  },
  'character_limit' => {
    'enabled' => true,
    'number' => 72
  },
  'summary_character_limit' => {
    'enabled' => true,
    'number' => 50
  },
  'disallow_generic' => {
    'enabled' => true,
    'words' => %w[fix fixed fixes oops todo fixme commit changes hm hmm hmmm
                  test tests quickfix]
  },
  'enforce_capitalized' => {
    'enabled' => true
  }
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(path = '.poper.yml') ⇒ ConfigFile

Returns a new instance of ConfigFile.



25
26
27
# File 'lib/poper2/config_file.rb', line 25

def initialize(path = '.poper.yml')
  @path = path
end

Instance Method Details

#to_hObject



29
30
31
32
# File 'lib/poper2/config_file.rb', line 29

def to_h
  hash = File.exist?(@path) ? YAML.load_file(@path) : {}
  deep_merge(hash)
end