tag:blogger.com,1999:blog-14744716.post4723390702954806892..comments2024-02-22T18:04:19.754+05:30Comments on My conversations with gullible machines...: Method resolution in Ruby : OR how to find Mr. Right method?Gishuhttp://www.blogger.com/profile/17616896114730114577noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-14744716.post-43092187347014550432010-03-04T12:03:13.703+05:302010-03-04T12:03:13.703+05:30Didn't go over your blog post, and too tired t...Didn't go over your blog post, and too tired to think very straight, but a couple of things:<br />- best call it "singleton class" (there's even a singleton_class method coming up in 1.9.2)<br />- always check the hierarchy of stuff in Ruby 1.9, because Ruby 1.8's doesn't always return something meaningful for superclass (in particular for singleton classes of classes)<br />- The call order is complex. Hopefully I won't mess this up:<br />1) singleton class<br />2) class<br />3) included modules (starting with the last included)<br />4) superclass<br /><br />To complicate matters, the a_class.singleton_class.superclass == a_class.superclass.singleton_class!<br /><br />Of course, if the method is not found, then method_missing is called. It that isn't found, then an exception is raised.<br /><br />I'll improve this when I can think better... :-)Marc-André Lafortunehttps://www.blogger.com/profile/09989061778456912412noreply@blogger.com