lib/nanoc/base/compilation/item_rep_proxy.rb in nanoc-3.8.0 vs lib/nanoc/base/compilation/item_rep_proxy.rb in nanoc-4.0.0a1
- old
+ new
@@ -1,25 +1,27 @@
# encoding: utf-8
-module Nanoc
+module Nanoc::Int
# 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
# as assigns.
#
# The API provided by item representation proxies allows layout identifiers
- # to be given as literals instead of as references to {Nanoc::Layout}.
+ # to be given as literals instead of as references to {Nanoc::Int::Layout}.
+ #
+ # @api private
class ItemRepProxy
extend Forwardable
def_delegators :@item_rep, :item, :name, :binary, :binary?, :compiled_content, :has_snapshot?, :raw_path, :path
def_delegator :@item_rep, :snapshot
- # @param [Nanoc::ItemRep] item_rep The item representation that this
+ # @param [Nanoc::Int::ItemRep] item_rep The item representation that this
# proxy should behave like
#
- # @param [Nanoc::Compiler] compiler The compiler that will provide the
+ # @param [Nanoc::Int::Compiler] compiler The compiler that will provide the
# necessary compilation-related functionality.
def initialize(item_rep, compiler)
@item_rep = item_rep
@compiler = compiler
end
@@ -27,13 +29,13 @@
# Runs the item content through the given filter with the given arguments.
# This method will replace the content of the `:last` snapshot with the
# filtered content of the last snapshot.
#
# This method is supposed to be called only in a compilation rule block
- # (see {Nanoc::CompilerDSL#compile}).
+ # (see {Nanoc::Int::CompilerDSL#compile}).
#
- # @see Nanoc::ItemRep#filter
+ # @see Nanoc::Int::ItemRep#filter
#
# @param [Symbol] name The name of the filter to run the item
# representations' content through
#
# @param [Hash] args The filter arguments that should be passed to the
@@ -48,13 +50,13 @@
# Lays out the item using the given layout. This method will replace the
# content of the `:last` snapshot with the laid out content of the last
# snapshot.
#
# This method is supposed to be called only in a compilation rule block
- # (see {Nanoc::CompilerDSL#compile}).
+ # (see {Nanoc::Int::CompilerDSL#compile}).
#
- # @see Nanoc::ItemRep#layout
+ # @see Nanoc::Int::ItemRep#layout
#
# @param [String] layout_identifier The identifier of the layout to use
#
# @return [void]
def layout(layout_identifier, extra_filter_args = {})
@@ -72,12 +74,12 @@
#
# @api private
#
# @return [true]
#
- # @see Nanoc::ItemRep#proxy?
- # @see Nanoc::ItemRepRecorderProxy#proxy?
+ # @see Nanoc::Int::ItemRep#proxy?
+ # @see Nanoc::Int::ItemRepRecorderProxy#proxy?
def proxy?
true
end
alias_method :is_proxy?, :proxy?
@@ -90,11 +92,11 @@
def layouts
@compiler.site.layouts
end
def layout_with_identifier(layout_identifier)
- layout ||= layouts.find { |l| l.identifier == layout_identifier.cleaned_identifier }
- raise Nanoc::Errors::UnknownLayout.new(layout_identifier) if layout.nil?
+ layout ||= layouts.find { |l| l.identifier == layout_identifier.__nanoc_cleaned_identifier }
+ raise Nanoc::Int::Errors::UnknownLayout.new(layout_identifier) if layout.nil?
layout
end
end
end