Sha256: 9c169814c1255641f17c0804b0383fd9c6aa2fe8e238ecb7265da58fe2e32d94

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

module Nanoc::Int
  class ChecksumCollection
    include Nanoc::Int::ContractsSupport
    extend Nanoc::Int::Memoization

    c_obj = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration, Nanoc::Int::CodeSnippet]

    def initialize(checksums)
      @checksums = checksums
    end

    contract c_obj => C::Maybe[String]
    def checksum_for(obj)
      @checksums[obj.reference]
    end

    contract c_obj => C::Maybe[String]
    def content_checksum_for(obj)
      @checksums[[obj.reference, :content]]
    end

    contract c_obj => C::Maybe[C::HashOf[Symbol, String]]
    def attributes_checksum_for(obj)
      @checksums[[obj.reference, :each_attribute]]
    end

    def to_h
      @checksums
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.7.9 lib/nanoc/base/entities/checksum_collection.rb
nanoc-4.7.8 lib/nanoc/base/entities/checksum_collection.rb