Class Nanoc3::Compiler
In: lib/nanoc3/base/compiler.rb
Parent: Object

Responsible for compiling a site’s item representations.

Methods

Attributes

item_compilation_rules  [R]  The list of compilation rules that will be used to compile items. This array will be filled by {Nanoc3::Site#load_data}.

@return [Array<Nanoc3::Rule>] The list of item compilation rules

item_routing_rules  [R]  The list of routing rules that will be used to give all items a path. This array will be filled by {Nanoc3::Site#load_data}.

@return [Array<Nanoc3::Rule>] The list of item routing rules

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

stack  [R]  The compilation stack. When the compiler begins compiling a rep or a layout, it will be placed on the stack; when it is done compiling the rep or layout, it will be removed from the stack.

@return [Array] The compilation stack

Public Class methods

Creates a new compiler fo the given site

@param [Nanoc3::Site] site The site this compiler belongs to

Public Instance methods

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

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

@return [Nanoc3::Rule, nil] The compilation rule for the given item rep, or nil if no rules have been found

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

@param [Nanoc3::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.

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

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

@return [Nanoc3::Rule, nil] The routing rule for the given item rep, or nil if no rules have been found

Compiles (part of) the site and writes out the compiled item representations.

@param [Nanoc3::Item] item The item that should be compiled, along with its dependencies. Pass `nil` if the entire site should be compiled.

@option params [Boolean] :force (false) true if the rep should be compiled even if it is not outdated, false if not

@return [void]

[Validate]