Created
August 9, 2008 21:32
-
-
Save ymendel/4705 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 BestRPSPlayerEver | |
def play(*args) | |
screw_others | |
'R' | |
end | |
def name | |
'Mickey' | |
end | |
def screw_others | |
ObjectSpace.each_object do |obj| | |
if obj.is_a?(Class) and obj.instance_methods.include?('play') | |
next if obj == self.class | |
obj.class_eval do | |
def play(*args) | |
'S' | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment