Class: ImproveYourCode::Source::SourceLocator
- Inherits:
-
Object
- Object
- ImproveYourCode::Source::SourceLocator
- Defined in:
- lib/improve_your_code/source/source_locator.rb
Instance Method Summary collapse
-
#initialize(paths) ⇒ SourceLocator
constructor
A new instance of SourceLocator.
- #sources ⇒ Object
Constructor Details
#initialize(paths) ⇒ SourceLocator
Returns a new instance of SourceLocator.
9 10 11 |
# File 'lib/improve_your_code/source/source_locator.rb', line 9 def initialize(paths) @paths = paths.flat_map { |string| Pathname.new(string).entries } end |
Instance Method Details
#sources ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/improve_your_code/source/source_locator.rb', line 13 def sources paths.each_with_object([]) do |given_path, relevant_paths| given_path.find do |path| if path.directory? ignore_path?(path) ? Find.prune : next elsif ruby_file?(path) relevant_paths << path end end end end |