Class: Locomotive::Liquid::Drops::ContentEntry
- Defined in:
- lib/locomotive/liquid/drops/content_entry.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #_id ⇒ Object
- #_label ⇒ Object
- #before_method(meth) ⇒ Object
-
#next ⇒ Object
Returns the next content for the parent content type.
-
#previous ⇒ Object
Returns the previous content for the parent content type.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Locomotive::Liquid::Drops::Base
Instance Method Details
#_id ⇒ Object
8 9 10 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 8 def _id self._source._id.to_s end |
#_label ⇒ Object
12 13 14 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 12 def _label @_label ||= self._source._label end |
#before_method(meth) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 42 def before_method(meth) return '' if self._source.nil? if not @@forbidden_attributes.include?(meth.to_s) value = self._source.send(meth) if value.respond_to?(:all) # check for an association filter_and_order_list(value) else value end else nil end end |
#next ⇒ Object
Returns the next content for the parent content type. If no content is found, nil is returned.
Usage:
if article.next % <a href=“/articles/article.next._permalink }”>Read next article</a> endif %
25 26 27 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 25 def next @next ||= self._source.next.to_liquid end |
#previous ⇒ Object
Returns the previous content for the parent content type. If no content is found, nil is returned.
Usage:
if article.previous % <a href=“/articles/article.previous._permalink }”>Read previous article</a> endif %
38 39 40 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 38 def previous @previous ||= self._source.previous.to_liquid end |