Module: FlossFunding::Config

Defined in:
lib/floss_funding/config.rb

Overview

Handles configuration loading from a .floss_funding.yml file located at the
root of the including project (heuristically discovered by walking upward
from the including file path until a Gemfile or *.gemspec is found).

All APIs in this module require the including file path (e.g., __FILE__).

The loaded config is merged over DEFAULT_CONFIG, so any unspecified keys fall
back to defaults.

Class Method Summary collapse

Class Method Details

.find_project_rootString?

Expose project root discovery to allow tests and callers to stub or
override it. Delegates to ConfigFinder.

Returns:

  • (String, nil)


20
21
22
# File 'lib/floss_funding/config.rb', line 20

def find_project_root
  ::FlossFunding::ConfigFinder.project_root
end

.normalize_to_array(value) ⇒ Object

Normalize a value from YAML or gemspec to an array.

  • nil => []
  • array => same array
  • scalar => [scalar]


28
29
30
31
32
# File 'lib/floss_funding/config.rb', line 28

def normalize_to_array(value)
  return [] if value.nil?
  return value.compact if value.is_a?(Array)
  [value]
end