lib/nanoc/base/result_data/item_rep.rb in nanoc-3.7.3 vs lib/nanoc/base/result_data/item_rep.rb in nanoc-3.7.4
- old
+ new
@@ -180,18 +180,18 @@
include Deprecated
include Private
# @return [Nanoc::Item] The item to which this rep belongs
- attr_reader :item
+ attr_reader :item
# @return [Symbol] The representation's unique name
- attr_reader :name
+ attr_reader :name
# @return [Boolean] true if this rep is currently binary; false otherwise
- attr_reader :binary
- alias_method :binary?, :binary
+ attr_reader :binary
+ alias_method :binary?, :binary
# @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
attr_accessor :snapshots
@@ -240,11 +240,11 @@
Nanoc::NotificationCenter.post(:visit_started, item)
Nanoc::NotificationCenter.post(:visit_ended, item)
# Get name of last pre-layout snapshot
snapshot = params.fetch(:snapshot) { @content[:pre] ? :pre : :last }
- is_moving = [ :pre, :post, :last ].include?(snapshot)
+ is_moving = [:pre, :post, :last].include?(snapshot)
# Check existance of snapshot
if !is_moving && snapshots.find { |s| s.first == snapshot && s.last == true }.nil?
raise Nanoc::Errors::NoSuchSnapshot.new(self, snapshot)
end
@@ -261,13 +261,14 @@
#
# @return [Boolean] True if content exists for the snapshot with the
# given name, false otherwise
#
# @since 3.2.0
- def has_snapshot?(snapshot_name)
+ def snapshot?(snapshot_name)
!@content[snapshot_name].nil?
end
+ alias_method :has_snapshot?, :snapshot?
# Returns the item rep’s raw path. It includes the path to the output
# directory and the full filename.
#
# @option params [Symbol] :snapshot (:last) The snapshot for which the
@@ -442,29 +443,30 @@
#
# @api private
#
# @return [false]
#
- # @see Nanoc::ItemRepRecorderProxy#is_proxy?
- # @see Nanoc::ItemRepProxy#is_proxy?
- def is_proxy?
+ # @see Nanoc::ItemRepRecorderProxy#proxy?
+ # @see Nanoc::ItemRepProxy#proxy?
+ def proxy?
false
end
+ alias_method :is_proxy?, :proxy?
# Returns an object that can be used for uniquely identifying objects.
#
# @api private
#
# @return [Object] An unique reference to this object
def reference
- [ type, item.identifier, name ]
+ [type, item.identifier, name]
end
def inspect
"<#{self.class} name=\"#{name}\" binary=#{self.binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
end
- private
+ private
def initialize_content
# Initialize content and filenames
if self.binary?
@temporary_filenames = { :last => @item.raw_filename }