Class: Nanoc::ItemRepView
- Defined in:
- lib/nanoc/base/views/item_rep_view.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #binary? ⇒ Boolean private
-
#compiled_content(snapshot: nil) ⇒ String
Returns the compiled content.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(item_rep, context) ⇒ ItemRepView
constructor
private
A new instance of ItemRepView.
- #inspect ⇒ Object
-
#item ⇒ Nanoc::ItemWithRepsView
Returns the item that this item rep belongs to.
- #name ⇒ Symbol
-
#path(snapshot: :last) ⇒ String
Returns the item rep’s path, as used when being linked to.
- #raw_path(snapshot: :last) ⇒ Object private
- #unwrap ⇒ Object private
Methods inherited from View
Constructor Details
#initialize(item_rep, context) ⇒ ItemRepView
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ItemRepView.
4 5 6 7 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 4 def initialize(item_rep, context) super(context) @item_rep = item_rep end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 15 def ==(other) other.respond_to?(:item) && other.respond_to?(:name) && item == other.item && name == other.name end |
#binary? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
77 78 79 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 77 def binary? @item_rep.binary? end |
#compiled_content(snapshot: nil) ⇒ String
Returns the compiled content.
44 45 46 47 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 44 def compiled_content(snapshot: nil) @context.dependency_tracker.bounce(unwrap.item) @item_rep.compiled_content(snapshot: snapshot) end |
#eql?(other) ⇒ Boolean
20 21 22 23 24 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 20 def eql?(other) other.is_a?(self.class) && item.eql?(other.item) && name.eql?(other.name) end |
#hash ⇒ Object
27 28 29 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 27 def hash self.class.hash ^ item.identifier.hash ^ name.hash end |
#inspect ⇒ Object
81 82 83 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 81 def inspect "<#{self.class} item.identifier=#{item.identifier} name=#{name}>" end |
#item ⇒ Nanoc::ItemWithRepsView
Returns the item that this item rep belongs to.
66 67 68 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 66 def item Nanoc::ItemWithRepsView.new(@item_rep.item, @context) end |
#name ⇒ Symbol
32 33 34 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 32 def name @item_rep.name end |
#path(snapshot: :last) ⇒ String
Returns the item rep’s 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.
58 59 60 61 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 58 def path(snapshot: :last) @context.dependency_tracker.bounce(unwrap.item) @item_rep.path(snapshot: snapshot) end |
#raw_path(snapshot: :last) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 74 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 71 def raw_path(snapshot: :last) @context.dependency_tracker.bounce(unwrap.item) @item_rep.raw_path(snapshot: snapshot) end |
#unwrap ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 10 def unwrap @item_rep end |