Created
December 17, 2009 01:11
-
-
Save jlindley/258407 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module Kernel | |
def other | |
o = [] | |
ObjectSpace.each_object{|obj| o << obj unless (o==self)} | |
o | |
end | |
end | |
class Teapot | |
def me | |
puts "I am this teapot: #{self}" | |
end | |
def not_me | |
puts "I am not: #{other.join(',')}" | |
end | |
end | |
teapot = Teapot.new | |
teapot.me | |
teapot.not_me | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment