Class: Lifer::Builder::HTML::FromLiquid::Drops::TagDrop
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Lifer::Builder::HTML::FromLiquid::Drops::TagDrop
- Defined in:
- lib/lifer/builder/html/from_liquid/drops/tag_drop.rb
Overview
This drop allows users to access Lifer tag information from within Liquid templates.
Instance Attribute Summary collapse
-
#lifer_tag ⇒ Object
Returns the value of attribute lifer_tag.
Instance Method Summary collapse
-
#entries ⇒ Array<EntryDrop>
Gets all entries in a tag and converts them to entry drops that can be accessed in Liquid templates.
-
#initialize(lifer_tag) ⇒ TagDrop
constructor
A new instance of TagDrop.
-
#layout_file ⇒ String
The tag's layout file path.
-
#name ⇒ Symbol
The tag name.
Constructor Details
#initialize(lifer_tag) ⇒ TagDrop
Returns a new instance of TagDrop.
14 |
# File 'lib/lifer/builder/html/from_liquid/drops/tag_drop.rb', line 14 def initialize(lifer_tag) = (@lifer_tag = lifer_tag) |
Instance Attribute Details
#lifer_tag ⇒ Object
Returns the value of attribute lifer_tag.
12 13 14 |
# File 'lib/lifer/builder/html/from_liquid/drops/tag_drop.rb', line 12 def lifer_tag @lifer_tag end |
Instance Method Details
#entries ⇒ Array<EntryDrop>
Gets all entries in a tag and converts them to entry drops that can be accessed in Liquid templates. Example:
{% for entry in tags..entries %}
{{ entry.title }}
{% endfor %}
29 30 31 32 33 34 35 |
# File 'lib/lifer/builder/html/from_liquid/drops/tag_drop.rb', line 29 def entries @entries ||= lifer_tag.entries.map { |lifer_entry| EntryDrop.new lifer_entry, collection: CollectionDrop.new(lifer_entry.collection), tags: lifer_entry..map { TagDrop.new _1 } } end |
#layout_file ⇒ String
The tag's layout file path.
40 |
# File 'lib/lifer/builder/html/from_liquid/drops/tag_drop.rb', line 40 def layout_file = (@lifer_tag.layout_file) |
#name ⇒ Symbol
The tag name.
19 |
# File 'lib/lifer/builder/html/from_liquid/drops/tag_drop.rb', line 19 def name = (@name ||= lifer_tag.name) |