Sha256: b02ff8140ae66a6066e575a229b0ae969add3dd629bd68d313d4b948a8d569c7

Contents?: true

Size: 610 Bytes

Versions: 9

Compression:

Stored size: 610 Bytes

Contents

module Nanoc
  class PostCompileItemRepView < ::Nanoc::ItemRepView
    def compiled_content(snapshot: nil)
      snapshot_contents = @context.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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.7.1 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.7.0 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.6.4 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.6.3 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.6.2 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.6.1 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.6.0 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.5.4 lib/nanoc/base/views/post_compile_item_rep_view.rb
nanoc-4.5.3 lib/nanoc/base/views/post_compile_item_rep_view.rb