Module: RuboCop::FileFinder Private

Included in:
Config, ConfigFinder, ConfigLoader
Defined in:
lib/rubocop/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 Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.root_levelObject

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.



10
11
12
# File 'lib/rubocop/file_finder.rb', line 10

def root_level
  @root_level
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.



13
14
15
16
17
18
# File 'lib/rubocop/file_finder.rb', line 13

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.



20
21
22
23
24
# File 'lib/rubocop/file_finder.rb', line 20

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