Sha256: aa43e4395badcac88f2fcf3689040579929aad47326907d5bf0b75b2cbfff563

Contents?: true

Size: 518 Bytes

Versions: 10

Compression:

Stored size: 518 Bytes

Contents

module Propshaft::Resolver
  class Static
    attr_reader :manifest_path, :prefix

    def initialize(manifest_path:, prefix:)
      @manifest_path, @prefix = manifest_path, prefix
    end

    def resolve(logical_path)
      if asset_path = parsed_manifest[logical_path]
        File.join prefix, asset_path
      else
        raise Propshaft::MissingAssetError.new(logical_path)
      end
    end

    private
      def parsed_manifest
        @parsed_manifest ||= JSON.parse(manifest_path.read)
      end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
propshaft-0.5.0 lib/propshaft/resolver/static.rb
propshaft-0.4.4 lib/propshaft/resolver/static.rb
propshaft-0.4.3 lib/propshaft/resolver/static.rb
propshaft-0.4.2 lib/propshaft/resolver/static.rb
propshaft-0.4.1 lib/propshaft/resolver/static.rb
propshaft-0.4.0 lib/propshaft/resolver/static.rb
propshaft-0.3.1 lib/propshaft/resolver/static.rb
propshaft-0.3.0 lib/propshaft/resolver/static.rb
propshaft-0.2.2 lib/propshaft/resolver/static.rb
propshaft-0.2.1 lib/propshaft/resolver/static.rb