Class: Nanoc::Core::OutdatednessChecker::Basic Private

Inherits:
Object
  • Object
show all
Includes:
MemoWise
Defined in:
lib/nanoc/core/outdatedness_checker.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

Rules =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

include Nanoc::Core::ContractsSupport

Nanoc::Core::OutdatednessRules
RULES_FOR_ITEM_REP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  Rules::RulesModified,
  Rules::ContentModified,
  Rules::AttributesModified,
  Rules::NotWritten,
  Rules::CodeSnippetsModified,
  Rules::UsesAlwaysOutdatedFilter,
].freeze
RULES_FOR_LAYOUT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  Rules::RulesModified,
  Rules::ContentModified,
  Rules::AttributesModified,
  Rules::UsesAlwaysOutdatedFilter,
].freeze
RULES_FOR_CONFIG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  Rules::AttributesModified,
].freeze
RULES_FOR_ITEM_COLLECTION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  Rules::ItemCollectionExtended,
].freeze
RULES_FOR_LAYOUT_COLLECTION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  Rules::LayoutCollectionExtended,
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(outdatedness_checker:, reps:) ⇒ Basic

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

contract C::KeywordArgs[outdatedness_checker: OutdatednessChecker, reps: Nanoc::Core::ItemRepRepo] => C::Any



52
53
54
55
# File 'lib/nanoc/core/outdatedness_checker.rb', line 52

def initialize(outdatedness_checker:, reps:)
  @outdatedness_checker = outdatedness_checker
  @reps = reps
end

Instance Method Details

#outdatedness_status_for(obj) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

contract C_OBJ_MAYBE_REP => C::Maybe



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/nanoc/core/outdatedness_checker.rb', line 58

def outdatedness_status_for(obj)
  case obj
  when Nanoc::Core::ItemRep
    apply_rules(RULES_FOR_ITEM_REP, obj)
  when Nanoc::Core::Item
    apply_rules_multi(RULES_FOR_ITEM_REP, @reps[obj])
  when Nanoc::Core::Layout
    apply_rules(RULES_FOR_LAYOUT, obj)
  when Nanoc::Core::Configuration
    apply_rules(RULES_FOR_CONFIG, obj)
  when Nanoc::Core::ItemCollection
    apply_rules(RULES_FOR_ITEM_COLLECTION, obj)
  when Nanoc::Core::LayoutCollection
    apply_rules(RULES_FOR_LAYOUT_COLLECTION, obj)
  else
    raise Nanoc::Core::Errors::InternalInconsistency, "do not know how to check outdatedness of #{obj.inspect}"
  end
end