Class: Rodiff::Helpers::FileFinder
- Inherits:
-
Object
- Object
- Rodiff::Helpers::FileFinder
- Defined in:
- lib/rodiff/helpers/file_finder.rb
Instance Attribute Summary collapse
-
#root_dir ⇒ Object
readonly
Returns the value of attribute root_dir.
Instance Method Summary collapse
- #find_top_most(filename, start_dir, stop_dir = nil) ⇒ Object
- #find_upwards(filename, start_dir, stop_dir = nil) ⇒ Object
-
#initialize(root) ⇒ FileFinder
constructor
A new instance of FileFinder.
Constructor Details
#initialize(root) ⇒ FileFinder
Returns a new instance of FileFinder.
8 9 10 |
# File 'lib/rodiff/helpers/file_finder.rb', line 8 def initialize(root) @root_dir = root end |
Instance Attribute Details
#root_dir ⇒ Object (readonly)
Returns the value of attribute root_dir.
6 7 8 |
# File 'lib/rodiff/helpers/file_finder.rb', line 6 def root_dir @root_dir end |
Instance Method Details
#find_top_most(filename, start_dir, stop_dir = nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/rodiff/helpers/file_finder.rb', line 16 def find_top_most(filename, start_dir, stop_dir = nil) top_most_file = nil traverse_upwards(filename, start_dir, stop_dir) { |file| top_most_file = file } top_most_file end |
#find_upwards(filename, start_dir, stop_dir = nil) ⇒ Object
12 13 14 |
# File 'lib/rodiff/helpers/file_finder.rb', line 12 def find_upwards(filename, start_dir, stop_dir = nil) traverse_upwards(filename, start_dir, stop_dir) { |file| return file if file } # return first result end |