Class: Nanoc::ItemRepView
- Defined in:
- lib/nanoc/base/views/item_rep_view.rb
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
-
#compiled_content(snapshot: nil) ⇒ String
Returns the compiled content.
-
#hash ⇒ 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 Also known as: eql?
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.
38 39 40 41 42 43 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 38 def compiled_content(snapshot: nil) Nanoc::Int::NotificationCenter.post(:visit_started, unwrap.item) Nanoc::Int::NotificationCenter.post(:visit_ended, unwrap.item) @item_rep.compiled_content(snapshot: snapshot) end |
#hash ⇒ Object
21 22 23 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 21 def hash self.class.hash ^ item.identifier.hash ^ name.hash end |
#item ⇒ Nanoc::ItemWithRepsView
Returns the item that this item rep belongs to.
64 65 66 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 64 def item Nanoc::ItemWithRepsView.new(@item_rep.item, @context) end |
#name ⇒ Symbol
26 27 28 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 26 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.
54 55 56 57 58 59 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 54 def path(snapshot: :last) Nanoc::Int::NotificationCenter.post(:visit_started, unwrap.item) Nanoc::Int::NotificationCenter.post(:visit_ended, unwrap.item) @item_rep.path(snapshot: snapshot) end |