Class: Nanoc::ItemRepView
- Defined in:
- lib/nanoc/base/views/item_rep_view.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#==(other) ⇒ Object
-
#compiled_content(snapshot: nil) ⇒ String
Returns the compiled content.
-
#eql?(other) ⇒ Boolean
-
#hash ⇒ Object
-
#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.
Methods inherited from View
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 |
#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, compiled_content: true) @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, path: true) @item_rep.path(snapshot: snapshot) end |