Sha256: 306d23c057199921dfff5519cff378d7637bb7ec6be33ca994cd08cc8b90b3c0

Contents?: true

Size: 891 Bytes

Versions: 2

Compression:

Stored size: 891 Bytes

Contents

module Nanoc::Int::Compiler::Stages
  class CalculateChecksums
    def initialize(items:, layouts:, code_snippets:, config:)
      @items = items
      @layouts = layouts
      @code_snippets = code_snippets
      @config = config
    end

    def run
      checksums = {}

      [@items, @layouts].each do |documents|
        documents.each do |document|
          checksums[[document.reference, :content]] =
            Nanoc::Int::Checksummer.calc_for_content_of(document)
          checksums[[document.reference, :each_attribute]] =
            Nanoc::Int::Checksummer.calc_for_each_attribute_of(document)
        end
      end

      [@items, @layouts, @code_snippets, [@config]].each do |objs|
        objs.each do |obj|
          checksums[obj.reference] = Nanoc::Int::Checksummer.calc(obj)
        end
      end

      Nanoc::Int::ChecksumCollection.new(checksums)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.7.9 lib/nanoc/base/services/compiler/stages/calculate_checksums.rb
nanoc-4.7.8 lib/nanoc/base/services/compiler/stages/calculate_checksums.rb