Class: Propshaft::Resolver::Static

Inherits:
Object
  • Object
show all
Defined in:
lib/propshaft/resolver/static.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manifest_path:, prefix:) ⇒ Static

Returns a new instance of Static.



5
6
7
# File 'lib/propshaft/resolver/static.rb', line 5

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

Instance Attribute Details

#manifest_pathObject (readonly)

Returns the value of attribute manifest_path.



3
4
5
# File 'lib/propshaft/resolver/static.rb', line 3

def manifest_path
  @manifest_path
end

#prefixObject (readonly)

Returns the value of attribute prefix.



3
4
5
# File 'lib/propshaft/resolver/static.rb', line 3

def prefix
  @prefix
end

Instance Method Details

#resolve(logical_path) ⇒ Object



9
10
11
12
13
# 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