class Nanoc::Int::ChecksumStore
Stores checksums for objects in order to be able to detect whether a file has changed since the last site compilation.
@api private
Public Class Methods
new(site: nil)
click to toggle source
@param [Nanoc::Int::Site] site
Calls superclass method
Nanoc::Int::Store.new
# File lib/nanoc/base/repos/checksum_store.rb, line 8 def initialize(site: nil) super('tmp/checksums', 1) @site = site @checksums = {} end
Public Instance Methods
[](obj)
click to toggle source
Returns the old checksum for the given object. This makes sense for items, layouts and code snippets.
@param [#reference] obj The object for which to fetch the checksum
@return [String] The checksum for the given object
# File lib/nanoc/base/repos/checksum_store.rb, line 22 def [](obj) @checksums[obj.reference] end
[]=(obj, checksum)
click to toggle source
Sets the checksum for the given object.
@param [#reference] obj The object for which to set the checksum
@param [String] checksum The checksum
# File lib/nanoc/base/repos/checksum_store.rb, line 31 def []=(obj, checksum) @checksums[obj.reference] = checksum end
Protected Instance Methods
data()
click to toggle source
# File lib/nanoc/base/repos/checksum_store.rb, line 37 def data @checksums end
data=(new_data)
click to toggle source
# File lib/nanoc/base/repos/checksum_store.rb, line 41 def data=(new_data) @checksums = new_data end