class Hanami::Assets::Config::Manifest
Manifest
file
@since 0.1.0 @api private
Constants
- SUBRESOURCE_INTEGRITY
@since 0.3.0 @api private
- TARGET
@since 0.4.0 @api private
Public Class Methods
Return a new instance
@param assets [Hash] the content of the manifest @param manifest_path [Pathname] the path to the manifest
@return [Hanami::Assets::Config::Manifest] a new instance
@since 0.1.0 @api private
@see Hanami::Assets::Configuration#manifest
@see Hanami::Assets::Configuration#manifest_path
# File lib/hanami/assets/config/manifest.rb, line 106 def initialize(assets, manifest_path) @assets = assets @manifest_path = manifest_path end
Public Instance Methods
Resolve the given asset into a fingerprinted path
For a given path /assets/application.js
it will return /assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js
@param asset [#to_s] the relative asset path
@return [String] the fingerprinted path
@raise [Hanami::Assets::MissingManifestAssetError] when the asset can't be
found in manifest
# File lib/hanami/assets/config/manifest.rb, line 122 def resolve(asset) @assets.fetch(asset.to_s) do raise Hanami::Assets::MissingManifestAssetError.new(asset, @manifest_path) end end
@since 0.3.0 @api private
# File lib/hanami/assets/config/manifest.rb, line 136 def subresource_integrity_values(path) resolve(path).fetch(SUBRESOURCE_INTEGRITY) end
@since 0.3.0 @api private
# File lib/hanami/assets/config/manifest.rb, line 130 def target(path) resolve(path).fetch(TARGET) end