class AssetFinder::PathPatternCollection

Attributes

path_patterns[R]

Public Class Methods

new(path_patterns:) click to toggle source
# File lib/asset_finder/path_pattern_collection.rb, line 3
def initialize(path_patterns:)
  @path_patterns = Array(path_patterns)

  freeze
end

Public Instance Methods

match(path:) click to toggle source
# 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:) click to toggle source
# 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