Sha256: 006eea2e306a95302d42417559a5ad05e048a030a70df536f4a9cae417e8c757

Contents?: true

Size: 862 Bytes

Versions: 8

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

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

        include Nanoc::Core::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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nanoc-4.11.8 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.7 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.6 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.5 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.4 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.3 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.2 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
nanoc-4.11.1 lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb