Class: AssetFinder::Stylesheet::PathCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/asset_finder/stylesheet/path_collector.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_dir:, path_pattern_collection:) ⇒ PathCollector

Returns a new instance of PathCollector.



6
7
8
9
10
11
# File 'lib/asset_finder/stylesheet/path_collector.rb', line 6

def initialize(root_dir:, path_pattern_collection:)
  @root_dir = root_dir
  @path_pattern_collection = path_pattern_collection

  freeze
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
# File 'lib/asset_finder/stylesheet/path_collector.rb', line 13

def execute
  [].tap do |paths|
    Find.find(root_dir).each do |path|
      next unless path_pattern_collection.match?(path: path)

      paths << path
    end
  end
end