class AssetFinder::Stylesheet::Normalizer

Attributes

path_pattern_collection[R]
root_dir[R]

Public Class Methods

new(root_dir:, path_pattern_collection:) click to toggle source
# File lib/asset_finder/stylesheet/normalizer.rb, line 4
def initialize(root_dir:, path_pattern_collection:)
  @root_dir = root_dir.to_s
  @path_pattern_collection = path_pattern_collection

  freeze
end

Public Instance Methods

normalize(path) click to toggle source
# File lib/asset_finder/stylesheet/normalizer.rb, line 11
def normalize(path)
  match = path_pattern_collection.match(path: path)
  return unless match

  match[1].sub(root_dir, '') + '.css'
end