Created
February 13, 2012 10:56
-
-
Save jayniz/1816026 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 Jogger | |
module NamedTraversals | |
# Traverse to somebody's woman friends | |
def self.friends(current_traversal, gender) | |
t = current_traversal.in(:friends) | |
t = t.filter(gender: gender) | |
end | |
# Group and sort | |
def self.top_list(current_traversal, type) | |
t = current_traversal.out(type) | |
t = t.filter(type: 'Movie') | |
t = t.group_count{ |v| v } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment