Sha256: ab5acb8196a6d23ff2b744702a3e51c796e99a750d122a981002fd9257998c0a

Contents?: true

Size: 543 Bytes

Versions: 6

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

module Bemer
  class AssetMatcher
    def initialize(loose_app_assets)
      @loose_app_assets = loose_app_assets
    end

    def call(logical_path, filename = nil)
      filename = Rails.application.assets.resolve(logical_path).to_s if filename.nil?

      return if [Bemer.path, *Bemer.asset_paths].detect { |path| filename.start_with?(path.to_s) }

      loose_app_assets.call(logical_path, filename) if loose_app_assets.respond_to?(:call)
    end

    protected

    attr_reader :loose_app_assets
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bemer-0.6.0 lib/bemer/asset_matcher.rb
bemer-0.5.0 lib/bemer/asset_matcher.rb
bemer-0.4.0 lib/bemer/asset_matcher.rb
bemer-0.3.0 lib/bemer/asset_matcher.rb
bemer-0.2.0 lib/bemer/asset_matcher.rb
bemer-0.1.0 lib/bemer/asset_matcher.rb