Ruby: How to get methods of a class without its object?
"abc" .respond_to? (: sub) returns true, but String.respond_to? (: sub) returns false. The second returns false because it asks if objects of class Class have a sub method since String is a class object. Ditto for methods () ...
How can I do these things and especially respond to_ (?) Without creating an object of that class.
+2
source to share
2 answers