Class: Nanoc::Core::OutdatednessRules::RulesModified

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

Instance Method Summary collapse

Methods inherited from Nanoc::Core::OutdatednessRule

affects_attributes?, affects_compiled_content?, affects_path?, affects_props, affects_raw_content?, #call, #inspect

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Instance Method Details

#apply(obj, basic_outdatedness_checker) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nanoc/core/outdatedness_rules/rules_modified.rb', line 9

def apply(obj, basic_outdatedness_checker)
  # Check rules of obj itself
  if rules_modified?(obj, basic_outdatedness_checker)
    return Nanoc::Core::OutdatednessReasons::RulesModified
  end

  # Check rules of layouts used by obj
  layouts = layouts_touched_by(obj, basic_outdatedness_checker)
  if layouts.any? { |layout| rules_modified?(layout, basic_outdatedness_checker) }
    return Nanoc::Core::OutdatednessReasons::RulesModified
  end

  nil
end