Created
October 15, 2009 12:09
-
-
Save oneup/210915 to your computer and use it in GitHub Desktop.
rails styles find_by_* automethods
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
# make on_collision_with() | |
def self.register_collision_classes | |
result = instance_methods.grep(/^#{COLLISION_HANDLER_PREFIX}/).map do |method_name| | |
name_of_handled = method_name[/^#{COLLISION_HANDLER_PREFIX}_?(.*)/,1] | |
Game.referee.track(self.underscore_name,name_of_handled.empty? ? :any : name_of_handled) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment