Class: Nanoc::Int::ChecksumStore Private

Inherits:
Store
  • Object
show all
Defined in:
lib/nanoc/base/repos/checksum_store.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Stores checksums for objects in order to be able to detect whether a file has changed since the last site compilation.

Instance Attribute Summary

Attributes inherited from Store

#filename, #version

Instance Method Summary collapse

Methods inherited from Store

#load, #no_data_found, #store, #version_mismatch_detected

Constructor Details

#initialize(site: nil) ⇒ ChecksumStore

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ChecksumStore.

Parameters:



8
9
10
11
12
13
14
# File 'lib/nanoc/base/repos/checksum_store.rb', line 8

def initialize(site: nil)
  super('tmp/checksums', 1)

  @site = site

  @checksums = {}
end

Instance Method Details

#[](obj) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the old checksum for the given object. This makes sense for items, layouts and code snippets.

Parameters:

  • obj (#reference)

    The object for which to fetch the checksum

Returns:

  • (String)

    The checksum for the given object



22
23
24
# File 'lib/nanoc/base/repos/checksum_store.rb', line 22

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

#[]=(obj, checksum) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets the checksum for the given object.

Parameters:

  • obj (#reference)

    The object for which to set the checksum

  • checksum (String)

    The checksum



31
32
33
# File 'lib/nanoc/base/repos/checksum_store.rb', line 31

def []=(obj, checksum)
  @checksums[obj.reference] = checksum
end