Sha256: 53e307bfa0d7f26ea9dec9ea4208db1c582a99ba3e16fd3368fe12f6908a44f9

Contents?: true

Size: 732 Bytes

Versions: 2

Compression:

Stored size: 732 Bytes

Contents

module Nanoc::Int::OutdatednessRules
  class CodeSnippetsModified < Nanoc::Int::OutdatednessRule
    extend Nanoc::Int::Memoization

    include Nanoc::Int::ContractsSupport

    affects_props :raw_content, :attributes, :compiled_content, :path

    def apply(_obj, outdatedness_checker)
      if any_snippets_modified?(outdatedness_checker)
        Nanoc::Int::OutdatednessReasons::CodeSnippetsModified
      end
    end

    private

    memoized def any_snippets_modified?(outdatedness_checker)
      outdatedness_checker.site.code_snippets.any? do |cs|
        ch_old = outdatedness_checker.checksum_store[cs]
        ch_new = outdatedness_checker.checksums.checksum_for(cs)
        ch_old != ch_new
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.7.9 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.7.8 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb