Skip to content

Instantly share code, notes, and snippets.

@ymendel
Created August 9, 2008 21:32
Show Gist options
  • Save ymendel/4705 to your computer and use it in GitHub Desktop.
Save ymendel/4705 to your computer and use it in GitHub Desktop.
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