lib/nanoc3/base/compilation/rule.rb in nanoc3-3.2.0a3 vs lib/nanoc3/base/compilation/rule.rb in nanoc3-3.2.0a4
- old
+ new
@@ -14,10 +14,12 @@
# using this rule
attr_reader :rep_name
# @return [Symbol] The name of the snapshot this rule will apply to.
# Ignored for compilation rules, but used for routing rules.
+ #
+ # @since 3.2.0
attr_reader :snapshot_name
# Creates a new item compilation rule with the given identifier regex,
# compiler and block. The block will be called during compilation with the
# item rep as its argument.
@@ -60,10 +62,10 @@
# @raise [ArgumentError] if no compiler is passed
#
# @return [void]
def apply_to(rep, params={})
compiler = params[:compiler] or raise ArgumentError, "Required :compiler option is missing"
- rep = Nanoc3::ItemRepProxy.new(rep, compiler)
+ rep = Nanoc3::ItemRepProxy.new(rep, compiler) unless rep.is_proxy?
Nanoc3::RuleContext.new(:rep => rep, :compiler => compiler).instance_eval &@block
end
end