Class: Landable::Liquid::CategoriesDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/landable/liquid/drops.rb

Overview

CategoryProxy gives us these:

categories.size }

for category in categories %

{{ category.name }}: {{ category.pages.size }} pages

endfor %

<h1>Blog posts</h1> <ul>

{% for page in categories.blog.pages %}
  <li><a href="{{ page.url }}">{{ page.name }}</a></li>
{% endfor %}

</ul>

Instance Method Summary collapse

Instance Method Details

#before_method(method_name) ⇒ Object



22
23
24
# File 'lib/landable/liquid/drops.rb', line 22

def before_method(method_name)
  category_cache[method_name] ||= ::Landable::Category.find_by_slug method_name
end

#each(&block) ⇒ Object



30
31
32
# File 'lib/landable/liquid/drops.rb', line 30

def each(&block)
  ::Landable::Category.all.each(&block)
end

#sizeObject



26
27
28
# File 'lib/landable/liquid/drops.rb', line 26

def size
  @size ||= Category.count
end