Created
April 11, 2014 01:52
-
-
Save googya/10436811 to your computer and use it in GitHub Desktop.
show secret when creating a class in Ruby
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
puts ObjectSpace.count_objects[:T_CLASS]; class Z; end; puts ObjectSpace.count_objects[:T_CLASS] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
可以找到新建的两个对象的地址, 然后根据其他属性判断, 哪个是 class, 哪个是 metaclass