Sunday, 8 September 2013

is there a way to get only a Ruby class' class methods

is there a way to get only a Ruby class' class methods

I use:
1.9.3-p448 :057 > Object.methods
=> 270
1.9.3-p448 :058 > Object.instance_methods
=> 153
but is there a way to just get class methods like:
1.9.3-p448 :058 > Object.class_methods
I know I could:
1.9.3-p448 :057 > Object.methods - Object.instance_methods
but is there a way to just get them directly? Also, is there anything it
could be besides a class method in the latter/
thx

No comments:

Post a Comment