Class: Nanoc::PostCompileItemRepView

Inherits:
ItemRepView show all
Defined in:
lib/nanoc/base/views/post_compile_item_rep_view.rb

Instance Method Summary collapse

Methods inherited from ItemRepView

#==, #eql?, #hash, #inspect, #item, #name, #path, #snapshot?

Methods inherited from View

#frozen?, #inspect

Instance Method Details

#compiled_content(snapshot: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nanoc/base/views/post_compile_item_rep_view.rb', line 5

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

#raw_path(snapshot: :last) ⇒ Object



22
23
24
# File 'lib/nanoc/base/views/post_compile_item_rep_view.rb', line 22

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