Parent

Class/Module Index [+]

Quicksearch

Nanoc::OutdatednessChecker

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

@api private

Public Class Methods

new(params={}) click to toggle source

@option params [Nanoc::Site] :site (nil) The site this outdatedness

checker belongs to.

@option params [Nanoc::ChecksumStore] :checksum_store (nil) The

checksum store where checksums of items, layouts, … are stored.

@option params [Nanoc::DependencyTracker] :dependency_tracker (nil) The

dependency tracker for the given site.
# File lib/nanoc/base/compilation/outdatedness_checker.rb, line 19
def initialize(params={})
  @site = params[:site] or raise ArgumentError,
    'Nanoc::OutdatednessChecker#initialize needs a :site parameter'
  @checksum_store = params[:checksum_store] or raise ArgumentError,
    'Nanoc::OutdatednessChecker#initialize needs a :checksum_store parameter'
  @dependency_tracker = params[:dependency_tracker] or raise ArgumentError,
    'Nanoc::OutdatednessChecker#initialize needs a :dependency_tracker parameter'

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

Public Instance Methods

outdated?(obj) click to toggle source

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

@param [Nanoc::Item, Nanoc::ItemRep, Nanoc::Layout] obj The object

whose outdatedness should be checked.

@return [Boolean] true if the object is outdated, false otherwise

# File lib/nanoc/base/compilation/outdatedness_checker.rb, line 39
def outdated?(obj)
  !outdatedness_reason_for(obj).nil?
end
outdatedness_reason_for(obj) click to toggle source

Calculates the reason why the given object is outdated.

@param [Nanoc::Item, Nanoc::ItemRep, Nanoc::Layout] obj The object

whose outdatedness reason should be calculated.

@return [Nanoc::OutdatednessReasons::Generic, nil] The reason why the

given object is outdated, or nil if the object is not outdated.
# File lib/nanoc/base/compilation/outdatedness_checker.rb, line 50
def outdatedness_reason_for(obj)
  reason = basic_outdatedness_reason_for(obj)
  if reason.nil? && outdated_due_to_dependencies?(obj)
    reason = Nanoc::OutdatednessReasons::DependenciesOutdated
  end
  reason
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.