Skip to content

Instantly share code, notes, and snippets.

@tj

tj/gist:34365

Created Dec 10, 2008
Embed
What would you like to do?
class Object
def metaclass
(class << self; self; end)
end
end
class Foo
puts "1. #{self} #{self.__id__}"
def meth1
puts "2. #{self} #{self.__id__}"
end
def self.meth2
puts "3. #{self} #{self.__id__}"
end
puts "4. #{self.metaclass} #{self.__id__}"
def meth3
puts "5. #{self.metaclass} #{self.__id__}"
end
end
Foo.new.meth1
Foo.meth2
Foo.new.meth3
puts "6. #{Foo} #{Foo.__id__}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.