Class: Locomotive::Liquid::Drops::ContentEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/liquid/drops/content_entry.rb

Instance Attribute Summary

Attributes inherited from Base

#_source

Instance Method Summary collapse

Methods inherited from Base

#id, #initialize, liquify

Constructor Details

This class inherits a constructor from Locomotive::Liquid::Drops::Base

Instance Method Details

#_idObject



8
9
10
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 8

def _id
  self._source._id.to_s
end

#_labelObject



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

#nextObject

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

#previousObject

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