class Passifier::Manifest

Attributes

hash[R]
to_hash[R]

Public Class Methods

new(asset_files, signing) click to toggle source

@param [Array<Passifier::StaticFile, Passifier::UrlSource>] asset_files The asset files to populate the manifest with @param [Passifier::Signing] signing The signing to sign the images and generate the digests with

# File lib/passifier/manifest.rb, line 12
def initialize(asset_files, signing)
  @asset_files = asset_files
  populate_content(signing)
end

Public Instance Methods

content() click to toggle source
# File lib/passifier/manifest.rb, line 21
def content
  to_hash.to_json
end
filename() click to toggle source
# File lib/passifier/manifest.rb, line 17
def filename
  "manifest.json"
end

Private Instance Methods

populate_content(signing) click to toggle source

Convert the image files into signed SHA1 digests for use in the manifest file @return [String] The resulting contents of the manifest file (aka Passifier::Manifest#content)

# File lib/passifier/manifest.rb, line 29
def populate_content(signing)
  @hash = {}
  @asset_files.each { |file| @hash[file.name] = signing.sha(file.content) }
end