Class: Templatecop::PathFinder
- Inherits:
-
Object
- Object
- Templatecop::PathFinder
- Defined in:
- lib/templatecop/path_finder.rb
Overview
Collect file paths from given path patterns.
Instance Method Summary collapse
- #call ⇒ Array<String>
-
#initialize(default_patterns:, patterns:) ⇒ PathFinder
constructor
A new instance of PathFinder.
Constructor Details
#initialize(default_patterns:, patterns:) ⇒ PathFinder
Returns a new instance of PathFinder.
10 11 12 13 14 15 16 |
# File 'lib/templatecop/path_finder.rb', line 10 def initialize( default_patterns:, patterns: ) @default_patterns = default_patterns @patterns = patterns end |
Instance Method Details
#call ⇒ Array<String>
19 20 21 22 23 24 25 |
# File 'lib/templatecop/path_finder.rb', line 19 def call patterns.flat_map do |pattern| ::Pathname.glob(pattern).select(&:file?).map do |pathname| pathname..to_s end end.uniq.sort end |