Skip to content

Instantly share code, notes, and snippets.

@shiftkey
Created August 29, 2011 11:32
Show Gist options
  • Save shiftkey/1178225 to your computer and use it in GitHub Desktop.
Save shiftkey/1178225 to your computer and use it in GitHub Desktop.
Enumerating Fun and Games in Ruby
# all i wanted to do was this with what I thought was
# an Enumerable set of posts using Jekyll
{% for ps in site.posts.skip(3) %}
<!-- partial view -->
{% endfor %}
# but i couldn't work out what type site.posts was at runtime
# ( using .class didn't output anything
# i stumbled (literally) across this alternate syntax which works
{% for ps in site.posts offset:3 %}
<!-- partial view -->
{% endfor %}
# and this is how you do .Take as well
{% for ps in site.posts limit:20 %}
<!-- partial view -->
{% endfor %}
# sigh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment