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.



14
15
16
17
18
# File 'lib/nanoc/core/checksum_collection.rb', line 14

def initialize(checksums)
  @checksums = checksums

  @_attribute_checksums = {}
end

Instance Method Details

#attributes_checksum_for(obj) ⇒ Object



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

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

#checksum_for(obj) ⇒ Object



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

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

#content_checksum_for(obj) ⇒ Object



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

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

#to_hObject



36
37
38
# File 'lib/nanoc/core/checksum_collection.rb', line 36

def to_h
  @checksums
end