Sha256: 58b4d64c7bca8663cf9827a43fe209be4f26669b9b723da5a411a97c7c1caf11

Contents?: true

Size: 1.03 KB

Versions: 22

Compression:

Stored size: 1.03 KB

Contents

module Nanoc::Int
  # Stores checksums for objects in order to be able to detect whether a file
  # has changed since the last site compilation.
  #
  # @api private
  class ChecksumStore < ::Nanoc::Int::Store
    # @param [Nanoc::Int::Site] site
    def initialize(site: nil)
      super('tmp/checksums', 1)

      @site = site

      @checksums = {}
    end

    # 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
    def [](obj)
      @checksums[obj.reference]
    end

    # Sets the checksum for the given object.
    #
    # @param [#reference] obj The object for which to set the checksum
    #
    # @param [String] checksum The checksum
    def []=(obj, checksum)
      @checksums[obj.reference] = checksum
    end

    protected

    def data
      @checksums
    end

    def data=(new_data)
      @checksums = new_data
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
nanoc-4.3.4 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.3.3 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.3.2 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.3.1 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.3.0 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.2.4 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.2.3 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.2.2 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.2.1 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.2.0 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.6 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.2.0b1 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.5 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.4 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.3 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.2 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.1 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.0 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.0rc2 lib/nanoc/base/repos/checksum_store.rb
nanoc-4.1.0rc1 lib/nanoc/base/repos/checksum_store.rb