Class: Propshaft::LoadPath
- Inherits:
-
Object
- Object
- Propshaft::LoadPath
- Defined in:
- lib/propshaft/load_path.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #assets(content_types: nil) ⇒ Object
- #find(asset_name) ⇒ Object
-
#initialize(paths = []) ⇒ LoadPath
constructor
A new instance of LoadPath.
- #manifest ⇒ Object
Constructor Details
#initialize(paths = []) ⇒ LoadPath
Returns a new instance of LoadPath.
6 7 8 |
# File 'lib/propshaft/load_path.rb', line 6 def initialize(paths = []) @paths = Array(paths).collect { |path| Pathname.new(path) } end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
4 5 6 |
# File 'lib/propshaft/load_path.rb', line 4 def paths @paths end |
Instance Method Details
#assets(content_types: nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/propshaft/load_path.rb', line 14 def assets(content_types: nil) if content_types assets_by_path.values.select { |asset| asset.content_type.in?(content_types) } else assets_by_path.values end end |
#find(asset_name) ⇒ Object
10 11 12 |
# File 'lib/propshaft/load_path.rb', line 10 def find(asset_name) assets_by_path[asset_name] end |
#manifest ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/propshaft/load_path.rb', line 22 def manifest Hash.new.tap do |manifest| assets.each do |asset| manifest[asset.logical_path.to_s] = asset.digested_path.to_s end end end |