Sha256: e5298b5ead15b7d38e606e5d59e5ba7ff7cda2f57c18884b129e3ef1ad438b13

Contents?: true

Size: 757 Bytes

Versions: 18

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

module Nanoc::Int::OutdatednessRules
  class CodeSnippetsModified < Nanoc::Int::OutdatednessRule
    DDMemoize.activate(self)

    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

18 entries across 18 versions & 1 rubygems

Version Path
nanoc-4.11.0 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.10.4 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.10.3 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.10.2 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.10.1 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.10.0 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.9 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.8 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.7 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.6 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.5 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.4 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.3 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.2 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.1 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.9.0 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.8.19 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.8.18 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb