Sha256: c32e467fd1d628e94fe71ea5f3f567ce7c4a53cfccfbf13001131d1e584502f4

Contents?: true

Size: 1.67 KB

Versions: 27

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

module Nanoc
  class CompilationItemView < ::Nanoc::BasicItemView
    # Returns the compiled content.
    #
    # @param [String] rep The name of the representation
    #   from which the compiled content should be fetched. By default, the
    #   compiled content will be fetched from the default representation.
    #
    # @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 of the given rep at the given snapshot.
    def compiled_content(rep: :default, snapshot: nil)
      reps.fetch(rep).compiled_content(snapshot: snapshot)
    end

    # Returns the item 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 [String] rep The name of the representation
    #   from which the path should be fetched. By default, the path will be
    #   fetched from the default representation.
    #
    # @param [Symbol] snapshot The snapshot for which the
    #   path should be returned.
    #
    # @return [String] The item’s path.
    def path(rep: :default, snapshot: :last)
      reps.fetch(rep).path(snapshot: snapshot)
    end

    # Returns the representations of this item.
    #
    # @return [Nanoc::BasicItemRepCollectionView]
    def reps
      Nanoc::CompilationItemRepCollectionView.new(@context.reps[_unwrap], @context)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
nanoc-4.11.12 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.11 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.10 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.9 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.8 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.7 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.6 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.5 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.4 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.3 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.2 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.1 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.11.0 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.10.4 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.10.3 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.10.2 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.10.1 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.10.0 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.9.9 lib/nanoc/base/views/compilation_item_view.rb
nanoc-4.9.8 lib/nanoc/base/views/compilation_item_view.rb