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.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/nanoc/core/outdatedness_checker.rb', line 39

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 = {}
  @ran = false
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.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/nanoc/core/outdatedness_checker.rb', line 56

def outdatedness_reasons_for(obj)
  precalculate

  basic_reasons = @basic_outdatedness_statuses.fetch(obj).reasons
  unless basic_reasons.empty?
    return basic_reasons
  end

  obj = obj.item if obj.is_a?(Nanoc::Core::ItemRep)
  if @objs_outdated_due_to_dependencies.include?(obj)
    return [Reasons::DependenciesOutdated]
  end

  []
end