Class: Nanoc::Core::OutdatednessRules::ContentModified

Inherits:
Nanoc::Core::OutdatednessRule show all
Defined in:
lib/nanoc/core/outdatedness_rules/content_modified.rb

Instance Method Summary collapse

Methods inherited from Nanoc::Core::OutdatednessRule

affected_props, affects_props, #call, #inspect

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Instance Method Details

#apply(obj, outdatedness_checker) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/nanoc/core/outdatedness_rules/content_modified.rb', line 9

def apply(obj, outdatedness_checker)
  obj = obj.item if obj.is_a?(Nanoc::Core::ItemRep)

  ch_old = outdatedness_checker.checksum_store.content_checksum_for(obj)
  ch_new = outdatedness_checker.checksums.content_checksum_for(obj)
  if ch_old != ch_new
    Nanoc::Core::OutdatednessReasons::ContentModified
  end
end