Class: Nanoc::Core::ChecksumCollection

Inherits:
Object
  • Object
show all
Includes:
ContractsSupport
Defined in:
lib/nanoc/core/checksum_collection.rb

Instance Method Summary collapse

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Constructor Details

#initialize(checksums) ⇒ ChecksumCollection

Returns a new instance of ChecksumCollection.



10
11
12
13
14
# File 'lib/nanoc/core/checksum_collection.rb', line 10

def initialize(checksums)
  @checksums = checksums

  @_attribute_checksums = {}
end

Instance Method Details

#attributes_checksum_for(obj) ⇒ Object



27
28
29
# File 'lib/nanoc/core/checksum_collection.rb', line 27

def attributes_checksum_for(obj)
  @_attribute_checksums[obj] ||= @checksums[[obj.reference, :each_attribute]]
end

#checksum_for(obj) ⇒ Object



17
18
19
# File 'lib/nanoc/core/checksum_collection.rb', line 17

def checksum_for(obj)
  @checksums[obj.reference]
end

#content_checksum_for(obj) ⇒ Object



22
23
24
# File 'lib/nanoc/core/checksum_collection.rb', line 22

def content_checksum_for(obj)
  @checksums[[obj.reference, :content]]
end

#to_hObject



31
32
33
# File 'lib/nanoc/core/checksum_collection.rb', line 31

def to_h
  @checksums
end