class Propshaft::Resolver::Static

Attributes

manifest_path[R]
prefix[R]

Public Class Methods

new(manifest_path:, prefix:) click to toggle source
# File lib/propshaft/resolver/static.rb, line 5
def initialize(manifest_path:, prefix:)
  @manifest_path, @prefix = manifest_path, prefix
end

Public Instance Methods

read(logical_path) click to toggle source
# File lib/propshaft/resolver/static.rb, line 15
def read(logical_path)
  if asset_path = parsed_manifest[logical_path]
    manifest_path.dirname.join(asset_path).read
  end
end
resolve(logical_path) click to toggle source
# File lib/propshaft/resolver/static.rb, line 9
def resolve(logical_path)
  if asset_path = parsed_manifest[logical_path]
    File.join prefix, asset_path
  end
end

Private Instance Methods

parsed_manifest() click to toggle source
# File lib/propshaft/resolver/static.rb, line 22
def parsed_manifest
  @parsed_manifest ||= JSON.parse(manifest_path.read)
end