Class: Nanoc::Core::CompilationItemView

Inherits:
BasicItemView show all
Defined in:
lib/nanoc/core/compilation_item_view.rb

Direct Known Subclasses

PostCompileItemView

Instance Method Summary collapse

Methods inherited from BasicItemView

#binary?, #children, #parent, #raw_filename

Methods included from DocumentViewMixin

#==, #[], #_unwrap, #attributes, #eql?, #fetch, #hash, #identifier, #initialize, #inspect, #key?, #raw_content, #reference

Methods inherited from View

#_context, #_unwrap, #frozen?, #initialize, #inspect

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Instance Method Details

#compiled_content(rep: :default, snapshot: nil) ⇒ String

Returns the compiled content.



18
19
20
# File 'lib/nanoc/core/compilation_item_view.rb', line 18

def compiled_content(rep: :default, snapshot: nil)
  reps.fetch(rep).compiled_content(snapshot:)
end

#path(rep: :default, snapshot: :last) ⇒ String

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.



35
36
37
# File 'lib/nanoc/core/compilation_item_view.rb', line 35

def path(rep: :default, snapshot: :last)
  reps.fetch(rep).path(snapshot:)
end

#repsNanoc::Core::BasicItemRepCollectionView

Returns the representations of this item.



42
43
44
# File 'lib/nanoc/core/compilation_item_view.rb', line 42

def reps
  Nanoc::Core::CompilationItemRepCollectionView.new(@context.reps[_unwrap], @context)
end