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.



119
120
121
122
123
124
125
126
127
128
129
# File 'lib/nanoc/core/outdatedness_checker.rb', line 119

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.



108
109
110
# File 'lib/nanoc/core/outdatedness_checker.rb', line 108

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.



109
110
111
# File 'lib/nanoc/core/outdatedness_checker.rb', line 109

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.



105
106
107
# File 'lib/nanoc/core/outdatedness_checker.rb', line 105

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.



106
107
108
# File 'lib/nanoc/core/outdatedness_checker.rb', line 106

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.



107
108
109
# File 'lib/nanoc/core/outdatedness_checker.rb', line 107

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.



110
111
112
# File 'lib/nanoc/core/outdatedness_checker.rb', line 110

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.



131
132
133
# File 'lib/nanoc/core/outdatedness_checker.rb', line 131

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)


136
137
138
# File 'lib/nanoc/core/outdatedness_checker.rb', line 136

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.



141
142
143
144
145
146
147
148
149
150
# File 'lib/nanoc/core/outdatedness_checker.rb', line 141

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