Created
December 19, 2015 09:22
-
-
Save ttanimichi/421be63586755b745b2a 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
class Object | |
def original_class | |
(self.to_s =~ /#<Class:(\w+)>/) and const_get($1) | |
end | |
end | |
class Foo | |
class << self | |
def foo | |
:foo | |
end | |
original_class.foo # => :foo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment