Class: Nanoc::Int::OutdatednessChecker Private

Inherits:
Object
  • Object
show all
Extended by:
Memoization
Defined in:
lib/nanoc/base/compilation/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::Int::OutdatednessReasons

Constants included from Memoization

Memoization::NONE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Memoization

memoize

Constructor Details

#initialize(site:, checksum_store:, dependency_store:, rule_memory_store:, action_provider:, 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.

Parameters:



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/nanoc/base/compilation/outdatedness_checker.rb', line 21

def initialize(site:, checksum_store:, dependency_store:, rule_memory_store:, action_provider:, reps:)
  @site = site
  @checksum_store = checksum_store
  @dependency_store = dependency_store
  @rule_memory_store = rule_memory_store
  @action_provider = action_provider
  @reps = reps

  @basic_outdatedness_reasons = {}
  @outdatedness_reasons = {}
  @objects_outdated_due_to_dependencies = {}
end

Instance Attribute Details

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



8
9
10
# File 'lib/nanoc/base/compilation/outdatedness_checker.rb', line 8

def checksum_store
  @checksum_store
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.



9
10
11
# File 'lib/nanoc/base/compilation/outdatedness_checker.rb', line 9

def dependency_store
  @dependency_store
end

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



10
11
12
# File 'lib/nanoc/base/compilation/outdatedness_checker.rb', line 10

def rule_memory_store
  @rule_memory_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.



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

def site
  @site
end

Instance Method Details

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

Checks whether the given object is outdated and therefore needs to be recompiled.

Parameters:

Returns:

  • (Boolean)

    true if the object is outdated, false otherwise



41
42
43
# File 'lib/nanoc/base/compilation/outdatedness_checker.rb', line 41

def outdated?(obj)
  !outdatedness_reason_for(obj).nil?
end

#outdatedness_reason_for(obj) ⇒ Reasons::Generic?

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.

Calculates the reason why the given object is outdated.

Parameters:

Returns:

  • (Reasons::Generic, nil)

    The reason why the given object is outdated, or nil if the object is not outdated.



52
53
54
55
56
57
58
# File 'lib/nanoc/base/compilation/outdatedness_checker.rb', line 52

def outdatedness_reason_for(obj)
  reason = basic_outdatedness_reason_for(obj)
  if reason.nil? && outdated_due_to_dependencies?(obj)
    reason = Reasons::DependenciesOutdated
  end
  reason
end