class Passifier::Manifest

Attributes

hash[R]
to_hash[R]

Public Class Methods

new(asset_files, spec) click to toggle source

@param [Array<Passifier::StaticFile, Passifier::UrlSource>] asset_files The asset files to populate the manifest with @param [Passifier::Spec] spec The spec generated from the hash used to initialise a pass

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

Public Instance Methods

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

Private Instance Methods

populate_content() click to toggle source

Convert the image files into 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 30
def populate_content
  @hash = {}
  @asset_files.each { |file| @hash[file.name] = Digest::SHA1.hexdigest file.content }
  @hash["pass.json"] = Digest::SHA1.hexdigest @spec.to_json
end