| > Your example is just showing that the extended module only appears in the instance's singleton class, this has nothing to do with method cache. It's how the method cache is implemented that matters. The method cache works by invalidating anything below the class(es) whose methods have changed on the ancestor chain. You're right that it can't be seen from user code, but if you take the implementers at their word about how it works, then this should be a perfectly convincing demonstration. Or, if you don't believe me, read the source yourself: https://github.com/ruby/ruby/blob/ba6b0acdb6c371f9f7150bed6f... https://github.com/ruby/ruby/blob/1aa54bebaf274bc08e72f9ad38... The part that clears the class hierarchy is here: https://github.com/ruby/ruby/blob/1aa54bebaf274bc08e72f9ad38... Alternatively, see Koichi's presentation at RubyKaiga: http://www.atdot.net/~ko1/activities/RubyKaigi2013-ko1.pdf |