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.
-
#snapshot?(name) ⇒ Boolean
Methods inherited from View
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 17 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.
46 47 48 49 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 46 def compiled_content(snapshot: nil) @context.dependency_tracker.bounce(unwrap.item, compiled_content: true) @context.snapshot_repo.compiled_content(rep: unwrap, snapshot: snapshot) end |
#eql?(other) ⇒ Boolean
22 23 24 25 26 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 22 def eql?(other) other.is_a?(self.class) && item.eql?(other.item) && name.eql?(other.name) end |
#hash ⇒ Object
29 30 31 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 29 def hash self.class.hash ^ item.identifier.hash ^ name.hash end |
#inspect ⇒ Object
97 98 99 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 97 def inspect "<#{self.class} item.identifier=#{item.identifier} name=#{name}>" end |
#item ⇒ Nanoc::ItemWithRepsView
Returns the item that this item rep belongs to.
73 74 75 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 73 def item Nanoc::ItemWithRepsView.new(@item_rep.item, @context) end |
#name ⇒ Symbol
34 35 36 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 34 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.
65 66 67 68 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 65 def path(snapshot: :last) @context.dependency_tracker.bounce(unwrap.item, path: true) @item_rep.path(snapshot: snapshot) end |
#snapshot?(name) ⇒ Boolean
51 52 53 54 |
# File 'lib/nanoc/base/views/item_rep_view.rb', line 51 def snapshot?(name) @context.dependency_tracker.bounce(unwrap.item, compiled_content: true) @item_rep.snapshot?(name) end |