Class: Passbook::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/passbook/manifest.rb

Instance Method Summary collapse

Constructor Details

#initialize(*files) ⇒ Manifest

Returns a new instance of Manifest.



6
7
8
# File 'lib/passbook/manifest.rb', line 6

def initialize(*files)
  @files = files.flatten.compact
end

Instance Method Details

#contentObject



14
15
16
# File 'lib/passbook/manifest.rb', line 14

def content
  @content ||= dictionary.to_json
end

#dictionaryObject



18
19
20
21
22
# File 'lib/passbook/manifest.rb', line 18

def dictionary
  @files.each_with_object({}) do |file, dict|
    dict[file.filename] = Digest::SHA1.hexdigest(file.content)
  end
end

#filenameObject



10
11
12
# File 'lib/passbook/manifest.rb', line 10

def filename
  "manifest.json"
end