Class: Propshaft::Resolver::Dynamic
- Inherits:
-
Object
- Object
- Propshaft::Resolver::Dynamic
- Defined in:
- lib/propshaft/resolver/dynamic.rb
Instance Attribute Summary collapse
-
#load_path ⇒ Object
readonly
Returns the value of attribute load_path.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#initialize(load_path:, prefix:) ⇒ Dynamic
constructor
A new instance of Dynamic.
- #resolve(logical_path) ⇒ Object
Constructor Details
#initialize(load_path:, prefix:) ⇒ Dynamic
Returns a new instance of Dynamic.
5 6 7 |
# File 'lib/propshaft/resolver/dynamic.rb', line 5 def initialize(load_path:, prefix:) @load_path, @prefix = load_path, prefix end |
Instance Attribute Details
#load_path ⇒ Object (readonly)
Returns the value of attribute load_path.
3 4 5 |
# File 'lib/propshaft/resolver/dynamic.rb', line 3 def load_path @load_path end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
3 4 5 |
# File 'lib/propshaft/resolver/dynamic.rb', line 3 def prefix @prefix end |
Instance Method Details
#resolve(logical_path) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/propshaft/resolver/dynamic.rb', line 9 def resolve(logical_path) if asset = load_path.find(logical_path) File.join prefix, asset.digested_path else raise Propshaft::MissingAssetError.new(logical_path) end end |