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.

Defined Under Namespace

Classes: Basic

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

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.



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/nanoc/core/outdatedness_checker.rb', line 111

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.



100
101
102
# File 'lib/nanoc/core/outdatedness_checker.rb', line 100

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.



101
102
103
# File 'lib/nanoc/core/outdatedness_checker.rb', line 101

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.



97
98
99
# File 'lib/nanoc/core/outdatedness_checker.rb', line 97

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.



98
99
100
# File 'lib/nanoc/core/outdatedness_checker.rb', line 98

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.



99
100
101
# File 'lib/nanoc/core/outdatedness_checker.rb', line 99

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.



102
103
104
# File 'lib/nanoc/core/outdatedness_checker.rb', line 102

def site
  @site
end

Instance Method Details

#action_sequence_for(rep) ⇒ 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.



123
124
125
# File 'lib/nanoc/core/outdatedness_checker.rb', line 123

def action_sequence_for(rep)
  @action_sequences.fetch(rep)
end

#outdated?(obj) ⇒ Boolean

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:

  • (Boolean)


128
129
130
# File 'lib/nanoc/core/outdatedness_checker.rb', line 128

def outdated?(obj)
  outdatedness_reasons_for(obj).any?
end

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



133
134
135
136
137
138
139
140
141
142
# File 'lib/nanoc/core/outdatedness_checker.rb', line 133

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