Class: AssetFinder::PathPatternCollection
- Inherits:
-
Object
- Object
- AssetFinder::PathPatternCollection
- Defined in:
- lib/asset_finder/path_pattern_collection.rb
Direct Known Subclasses
Javascript::PathPatternCollection, Stylesheet::PathPatternCollection
Instance Method Summary collapse
-
#initialize(path_patterns:) ⇒ PathPatternCollection
constructor
A new instance of PathPatternCollection.
- #match(path:) ⇒ Object
- #match?(path:) ⇒ Boolean
Constructor Details
#initialize(path_patterns:) ⇒ PathPatternCollection
Returns a new instance of PathPatternCollection.
3 4 5 6 7 |
# File 'lib/asset_finder/path_pattern_collection.rb', line 3 def initialize(path_patterns:) @path_patterns = Array(path_patterns) freeze end |
Instance Method Details
#match(path:) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/asset_finder/path_pattern_collection.rb', line 17 def match(path:) path_patterns.each do |path_pattern| match = path_pattern.match(path: path) return match if match end nil end |
#match?(path:) ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/asset_finder/path_pattern_collection.rb', line 9 def match?(path:) path_patterns.each do |path_pattern| return true if path_pattern.match?(path: path) end false end |