Class: QuietQuality::Config::Finder

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

Constant Summary collapse

CONFIG_FILENAME =
".quiet_quality.yml"
MAXIMUM_SEARCH_DEPTH =
100

Instance Method Summary collapse

Constructor Details

#initialize(from:) ⇒ Finder

Returns a new instance of Finder.



7
8
9
# File 'lib/quiet_quality/config/finder.rb', line 7

def initialize(from:)
  @from = from
end

Instance Method Details

#config_pathObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/quiet_quality/config/finder.rb', line 11

def config_path
  return @_config_path if defined?(@_config_path)
  each_successive_enclosing_directory do |dir_path|
    file_path = dir_path.join(CONFIG_FILENAME)
    if file_path.exist?
      return @_config_path = file_path.to_s
    end
  end
  @_config_path = nil
rescue Errno::EACCES
  @_config_path = nil
end