Created
October 21, 2010 09:50
-
-
Save ramontayag/638224 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageDrop < Liquid::Drop | |
def initialize(page) | |
@page = page | |
end | |
def name | |
@page.name | |
end | |
def children | |
PagesDrop.new(page.children) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PagesDrop < Liquid::Drop | |
def initialize(pages) | |
@pages = pages | |
end | |
def group_by | |
GroupByDrop.new(@pages) | |
end | |
def all | |
@pages.all | |
end | |
def size | |
@pages.size | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case you don't know, a drop is what the Liquid templating language uses to expose methods/data of a particular object (because you don't want the user to have full access to the system in the templating language).
I want to be able to do this:
instead of