I got this question from this discussion. A method call like object.m does not always mean the class of ‘object’ has a ‘m’ method, just like the find method to a Array object is not directly originated from Array object, but from the mixed-in Enumerable module. My question is, given a method, how can we determine the class from which the method originated?
I got this question from this discussion . A method call like object.m does
Share
Any class/object method is an object in Ruby, and has some methods of it’s own.
So you can do this:
Quick bit of RegEx and you’re done.