Sha256: 83091ce142763274591df6a4355646bf23715141ba4536811f6baa39ec1541e1

Contents?: true

Size: 848 Bytes

Versions: 11

Compression:

Stored size: 848 Bytes

Contents

# frozen_string_literal: true

module Nanoc
  class PostCompileItemRepView < ::Nanoc::BasicItemRepView
    def item_view_class
      Nanoc::PostCompileItemView
    end

    def compiled_content(snapshot: nil)
      compilation_context = @context.compilation_context
      snapshot_contents = compilation_context.compiled_content_cache[unwrap]

      snapshot_name = snapshot || (snapshot_contents[:pre] ? :pre : :last)

      unless snapshot_contents[snapshot_name]
        raise Nanoc::Int::Errors::NoSuchSnapshot.new(unwrap, snapshot_name)
      end

      content = snapshot_contents[snapshot_name]
      if content.binary?
        raise Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem.new(unwrap)
      end

      content.string
    end

    def raw_path(snapshot: :last)
      @item_rep.raw_path(snapshot: snapshot)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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