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.
- #read(logical_path, options = {}) ⇒ Object
- #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
#read(logical_path, options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/propshaft/resolver/dynamic.rb', line 15 def read(logical_path, = {}) if asset = load_path.find(logical_path) asset.content(**) end end |
#resolve(logical_path) ⇒ Object
9 10 11 12 13 |
# 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 end end |