Class: Nanoc::Core::OutdatednessChecker Private

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

Overview

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.

Responsible for determining whether an item or a layout is outdated.

Constant Summary collapse

Reasons =

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::OutdatednessReasons
C_OBJ =

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.

C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep, Nanoc::Core::Configuration, Nanoc::Core::Layout, Nanoc::Core::ItemCollection]
C_ITEM_OR_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.

C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep]
C_ACTION_SEQUENCES =

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.

C::HashOf[C_OBJ => Nanoc::Core::ActionSequence]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Constructor Details

#initialize(site:, checksum_store:, checksums:, dependency_store:, action_sequence_store:, action_sequences:, reps:) ⇒ OutdatednessChecker

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 OutdatednessChecker.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nanoc/core/outdatedness_checker.rb', line 33

def initialize(site:, checksum_store:, checksums:, dependency_store:, action_sequence_store:, action_sequences:, reps:)
  @site = site
  @checksum_store = checksum_store
  @checksums = checksums
  @dependency_store = dependency_store
  @action_sequence_store = action_sequence_store
  @action_sequences = action_sequences
  @reps = reps

  @objects_outdated_due_to_dependencies = {}
end

Instance Attribute Details

#action_sequence_storeObject (readonly)

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.



14
15
16
# File 'lib/nanoc/core/outdatedness_checker.rb', line 14

def action_sequence_store
  @action_sequence_store
end

#action_sequencesObject (readonly)

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.



15
16
17
# File 'lib/nanoc/core/outdatedness_checker.rb', line 15

def action_sequences
  @action_sequences
end

#checksum_storeObject (readonly)

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.



11
12
13
# File 'lib/nanoc/core/outdatedness_checker.rb', line 11

def checksum_store
  @checksum_store
end

#checksumsObject (readonly)

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.



12
13
14
# File 'lib/nanoc/core/outdatedness_checker.rb', line 12

def checksums
  @checksums
end

#dependency_storeObject (readonly)

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.



13
14
15
# File 'lib/nanoc/core/outdatedness_checker.rb', line 13

def dependency_store
  @dependency_store
end

#siteObject (readonly)

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.



16
17
18
# File 'lib/nanoc/core/outdatedness_checker.rb', line 16

def site
  @site
end

Instance Method Details

#outdatedness_reasons_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.



46
47
48
49
50
51
52
53
54
55
# File 'lib/nanoc/core/outdatedness_checker.rb', line 46

def outdatedness_reasons_for(obj)
  basic_reasons = basic_outdatedness_statuses.fetch(obj).reasons
  if basic_reasons.any?
    basic_reasons
  elsif outdated_due_to_dependencies?(obj)
    [Reasons::DependenciesOutdated]
  else
    []
  end
end