Module: FlossFunding::FileFinder Private

Included in:
ConfigFinder, ConfigLoader, Inclusion, Library
Defined in:
lib/floss_funding/file_finder.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Common methods for finding files.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.root_level=(level) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/floss_funding/file_finder.rb', line 14

def self.root_level=(level)
  @root_level = level
end

.root_level?(path, stop_dir) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


18
19
20
# File 'lib/floss_funding/file_finder.rb', line 18

def self.root_level?(path, stop_dir)
  (@root_level || stop_dir) == path.to_s
end

Instance Method Details

#find_file_upwards(filename, start_dir, stop_dir = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
# File 'lib/floss_funding/file_finder.rb', line 22

def find_file_upwards(filename, start_dir, stop_dir = nil)
  traverse_files_upwards(filename, start_dir, stop_dir) do |file|
    # minimize iteration for performance
    return file if file
  end
end

#find_last_file_upwards(filename, start_dir, stop_dir = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
# File 'lib/floss_funding/file_finder.rb', line 29

def find_last_file_upwards(filename, start_dir, stop_dir = nil)
  last_file = nil
  traverse_files_upwards(filename, start_dir, stop_dir) { |file| last_file = file }
  last_file
end