-
-
Save aaronblohowiak/100953 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
# Behavior filter turns method names into select/reject filters | |
# Example | |
# class User | |
# has_manny :comments, :extend => BehaviorFilter | |
# end | |
module BehaviorFilter | |
# creates magic methods like these | |
# user.comments.from_blocked_commentors | |
# # => user.comments.select{ |c| user.blocking?(c.commentor) } | |
# | |
# user.comments.without_idolized_commentors | |
# # => user.comments.reject{ |c| user.idolizing?(c.commentor) } | |
def method_missing(method, *args) | |
#blah blah blah | |
super | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment