Class: Hanami::Assets::Config::Manifest Private
- Inherits:
-
Object
- Object
- Hanami::Assets::Config::Manifest
- Defined in:
- lib/hanami/assets/config/manifest.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Manifest file
Constant Summary collapse
- TARGET =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'target'.freeze
- SUBRESOURCE_INTEGRITY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'sri'.freeze
Instance Method Summary collapse
-
#initialize(assets, manifest_path) ⇒ Hanami::Assets::Config::Manifest
constructor
private
Return a new instance.
-
#resolve(asset) ⇒ String
private
Resolve the given asset into a fingerprinted path.
- #subresource_integrity_values(path) ⇒ Object private
- #target(path) ⇒ Object private
Constructor Details
#initialize(assets, manifest_path) ⇒ Hanami::Assets::Config::Manifest
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a new instance
96 97 98 99 |
# File 'lib/hanami/assets/config/manifest.rb', line 96 def initialize(assets, manifest_path) @assets = assets @manifest_path = manifest_path end |
Instance Method Details
#resolve(asset) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolve the given asset into a fingerprinted path
For a given path /assets/application.js
it will return /assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js
112 113 114 115 116 |
# File 'lib/hanami/assets/config/manifest.rb', line 112 def resolve(asset) @assets.fetch(asset.to_s) do raise Hanami::Assets::MissingManifestAssetError.new(asset, @manifest_path) end end |
#subresource_integrity_values(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
126 127 128 |
# File 'lib/hanami/assets/config/manifest.rb', line 126 def subresource_integrity_values(path) resolve(path).fetch(SUBRESOURCE_INTEGRITY) end |
#target(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
120 121 122 |
# File 'lib/hanami/assets/config/manifest.rb', line 120 def target(path) resolve(path).fetch(TARGET) end |