Class Nanoc::RulesCollection
In: lib/nanoc/base/compilation/rules_collection.rb
Parent: Object

Keeps track of the rules in a site.

@api private

Methods

Attributes

item_compilation_rules  [R]  @return [Array<Nanoc::Rule>] The list of item compilation rules that
  will be used to compile items.
item_routing_rules  [R]  @return [Array<Nanoc::Rule>] The list of routing rules that will be
  used to give all items a path.
layout_filter_mapping  [R]  The hash containing layout-to-filter mapping rules. This hash is ordered: iterating over the hash will happen in insertion order.

@return [Hash] The layout-to-filter mapping rules

preprocessor  [RW]  @return [Proc] The code block that will be executed after all data is
  loaded but before the site is compiled

Public Class methods

@param [Nanoc::Compiler] compiler The site’s compiler

Public Instance methods

Add the given rule to the list of item compilation rules.

@param [Nanoc::Rule] rule The item compilation rule to add

@return [void]

Add the given rule to the list of item routing rules.

@param [Nanoc::Rule] rule The item routing rule to add

@return [void]

@return [String] The checksum for this object. If its contents change,

  the checksum will change as well.

Finds the first matching compilation rule for the given item representation.

@param [Nanoc::ItemRep] rep The item rep for which to fetch the rule

@return [Nanoc::Rule, nil] The compilation rule for the given item rep,

  or nil if no rules have been found

Returns the Nanoc::CompilerDSL that should be used for this site.

Finds the filter name and arguments to use for the given layout.

@param [Nanoc::Layout] layout The layout for which to fetch the filter.

@return [Array, nil] A tuple containing the filter name and the filter

  arguments for the given layout.

@param [Nanoc::Item] item The item for which the compilation rules

  should be retrieved

@return [Array] The list of item compilation rules for the given item

Loads this site’s rules.

@return [void]

Makes the given rule memory serializable by calling `inspect` on the filter arguments, so that objects such as classes and filenames can be serialized.

@param [Array] rs The rule memory for a certain item rep

@return [Array] The serializable rule memory

@param [Nanoc::Layout] layout The layout to get the rule memory for

@return [Array] The rule memory for the given layout

@param [Nanoc::ItemRep] rep The item representation to get the rule

  memory for

@return [Array] The rule memory for the given item representation

Returns an object that can be used for uniquely identifying objects.

@return [Object] An unique reference to this object

Finds the first matching routing rule for the given item representation.

@param [Nanoc::ItemRep] rep The item rep for which to fetch the rule

@return [Nanoc::Rule, nil] The routing rule for the given item rep, or

  nil if no rules have been found

Returns the list of routing rules that can be applied to the given item representation. For each snapshot, the first matching rule will be returned. The result is a hash containing the corresponding rule for each snapshot.

@param [Nanoc::ItemRep] rep The item rep for which to fetch the rules

@return [Hash<Symbol, Nanoc::Rule>] The routing rules for the given rep

@return [Nanoc::RuleMemoryCalculator] The rule memory calculator

@param [Nanoc::Item] obj The object for which to check the rule memory

@return [Boolean] true if the rule memory for the given object has changed since the last compilation, false otherwise

@return [Nanoc::RuleMemoryStore] The rule memory store

@param [Nanoc::ItemRep] rep The item representation for which to fetch

  the list of snapshots

@return [Array] A list of snapshots, represented as arrays where the

  first element is the snapshot name (a Symbol) and the last element is
  a Boolean indicating whether the snapshot is final or not

Unloads this site’s rules.

@return [void]

[Validate]