lib/nanoc3/base/compilation/item_rep_proxy.rb in nanoc3-3.2.0a3 vs lib/nanoc3/base/compilation/item_rep_proxy.rb in nanoc3-3.2.0a4

- old
+ new

@@ -1,9 +1,7 @@ # encoding: utf-8 -require 'forwardable' - module Nanoc3 # Represents an item representation, but provides an interface that is # easier to use when writing compilation and routing rules. It is also # responsible for fetching the necessary information from the compiler, such @@ -63,22 +61,39 @@ # @return [void] def layout(layout_identifier) set_assigns layout = layout_with_identifier(layout_identifier) - filter_name, filter_args = @compiler.filter_for_layout(layout) + filter_name, filter_args = @compiler.rules_collection.filter_for_layout(layout) @item_rep.layout(layout, filter_name, filter_args) end + # Returns true because this item is already a proxy, and therefore doesn’t + # need to be wrapped anymore. + # + # @api private + # + # @return [true] + # + # @see Nanoc3::ItemRep#is_proxy? + # @see Nanoc3::ItemRepRecorderProxy#is_proxy? + def is_proxy? + true + end + private def set_assigns @item_rep.assigns = @compiler.assigns_for(@item_rep) end + def layouts + @compiler.site.layouts + end + def layout_with_identifier(layout_identifier) - layout ||= @compiler.site.layouts.find { |l| l.identifier == layout_identifier.cleaned_identifier } + layout ||= layouts.find { |l| l.identifier == layout_identifier.cleaned_identifier } raise Nanoc3::Errors::UnknownLayout.new(layout_identifier) if layout.nil? layout end end