Class: Slimcop::PathFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/slimcop/path_finder.rb

Overview

Collect file paths from given path patterns.

Instance Method Summary collapse

Constructor Details

#initialize(patterns:) ⇒ PathFinder



9
10
11
# File 'lib/slimcop/path_finder.rb', line 9

def initialize(patterns:)
  @patterns = patterns
end

Instance Method Details

#callArray<String>



14
15
16
17
18
# File 'lib/slimcop/path_finder.rb', line 14

def call
  @patterns.flat_map do |pattern|
    ::Pathname.glob(pattern).select(&:file?).map(&:to_s)
  end
end