Sha256: 3de04135cee336a8f166b77fcca553b733dbe127ab2abe9b32016cead433b74f
Contents?: true
Size: 1.99 KB
Versions: 3
Compression:
Stored size: 1.99 KB
Contents
module Nanoc class ItemRepView < ::Nanoc::View # @api private def initialize(item_rep, context) super(context) @item_rep = item_rep end # @api private def unwrap @item_rep end # @see Object#== def ==(other) other.respond_to?(:item) && other.respond_to?(:name) && item == other.item && name == other.name end alias eql? == # @see Object#hash def hash self.class.hash ^ item.identifier.hash ^ name.hash end # @return [Symbol] def name @item_rep.name end # Returns the compiled content. # # @param [String] snapshot The name of the snapshot from which to # fetch the compiled content. By default, the returned compiled content # will be the content compiled right before the first layout call (if # any). # # @return [String] The content at the given snapshot. def compiled_content(snapshot: nil) @context.dependency_tracker.bounce(unwrap.item) @item_rep.compiled_content(snapshot: snapshot) end # Returns the item rep’s path, as used when being linked to. It starts # with a slash and it is relative to the output directory. It does not # include the path to the output directory. It will not include the # filename if the filename is an index filename. # # @param [Symbol] snapshot The snapshot for which the path should be # returned. # # @return [String] The item rep’s path. def path(snapshot: :last) @context.dependency_tracker.bounce(unwrap.item) @item_rep.path(snapshot: snapshot) end # Returns the item that this item rep belongs to. # # @return [Nanoc::ItemWithRepsView] def item Nanoc::ItemWithRepsView.new(@item_rep.item, @context) end # @api private def raw_path(snapshot: :last) @context.dependency_tracker.bounce(unwrap.item) @item_rep.raw_path(snapshot: snapshot) end # @api private def binary? @item_rep.binary? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.2.1 | lib/nanoc/base/views/item_rep_view.rb |
nanoc-4.2.0 | lib/nanoc/base/views/item_rep_view.rb |
nanoc-4.2.0b1 | lib/nanoc/base/views/item_rep_view.rb |