Class: Nanoc::Core::OutdatednessChecker::Basic Private
- Inherits:
-
Object
- Object
- Nanoc::Core::OutdatednessChecker::Basic
- Includes:
- ContractsSupport
- 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.
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::ItemAdded, 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::LayoutAdded, 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
- C_OBJ_MAYBE_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.
Instance Method Summary collapse
-
#initialize(outdatedness_checker:, reps:) ⇒ Basic
constructor
private
A new instance of Basic.
- #outdatedness_status_for(obj) ⇒ Object private
Methods included from ContractsSupport
enabled?, included, setup_once, warn_about_performance
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.
Returns a new instance of Basic.
42 43 44 45 46 47 48 |
# File 'lib/nanoc/core/outdatedness_checker.rb', line 42 def initialize(outdatedness_checker:, reps:) @outdatedness_checker = outdatedness_checker @reps = reps # Memoize @_outdatedness_status_for = {} 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.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/nanoc/core/outdatedness_checker.rb', line 51 def outdatedness_status_for(obj) @_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, Nanoc::Core::LayoutCollection # Collections are never outdated. Objects inside them might be, # however. apply_rules([], obj) else raise Nanoc::Core::Errors::InternalInconsistency, "do not know how to check outdatedness of #{obj.inspect}" end end |