Class: Nanoc::ItemRepView
- Inherits:
-
View
- Object
- View
- Nanoc::ItemRepView
- Defined in:
- lib/nanoc/base/views/item_rep_view.rb
Instance Method Summary (collapse)
-
- (Object) ==(other)
(also: #eql?)
-
- (String) compiled_content(snapshot: nil)
Returns the compiled content.
-
- (Object) hash
-
- (Nanoc::ItemWithRepsView) item
Returns the item that this item rep belongs to.
-
- (Symbol) name
-
- (String) path(snapshot: :last)
Returns the item rep’s path, as used when being linked to.
Methods inherited from View
Instance Method Details
- (Object) ==(other) 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 |
- (String) compiled_content(snapshot: nil)
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 |
- (Object) hash
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 |
- (Nanoc::ItemWithRepsView) item
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 |
- (Symbol) name
26 27 28 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 26 def name @item_rep.name end |
- (String) path(snapshot: :last)
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 |