Sha256: a75882aeffc54ed08c18658508695832f33a7d873d0c10c128108fcaf4f3afa8

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Nanoc
  class CompilationItemRepView < ::Nanoc::BasicItemRepView
    # @abstract
    def item_view_class
      Nanoc::CompilationItemView
    end

    # Returns the item rep’s raw path. It includes the path to the output
    # directory and the full filename.
    #
    # @param [Symbol] snapshot The snapshot for which the path should be
    #   returned.
    #
    # @return [String] The item rep’s raw path.
    def raw_path(snapshot: :last)
      @context.dependency_tracker.bounce(unwrap.item, compiled_content: true)

      res = @item_rep.raw_path(snapshot: snapshot)

      unless @item_rep.compiled?
        Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(@item_rep))
      end

      res
    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, compiled_content: true)
      @context.snapshot_repo.compiled_content(rep: unwrap, snapshot: snapshot)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nanoc-4.8.19 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.18 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.17 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.16 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.15 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.14 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.13 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.12 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.11 lib/nanoc/base/views/compilation_item_rep_view.rb
nanoc-4.8.10 lib/nanoc/base/views/compilation_item_rep_view.rb