From: Daniel DeLorme Date: 2006-07-10T22:42:50+09:00 Subject: Re: Enumberable fails for class Subclass < Array; def enum... Laza wrote: > Array includes Enumerable. But when a subclass of Array redefines > each(), then Enumerable still refers to the original Array.each(). Why > is that? Your confusion is understandable but you've got the problem backward: that behavior is not because Enumerable uses Array's each, it's because Array defines its own version of collect. Look at Array's local (non-inherited) methods: [].public_methods(false).sort => ["&", "*", "+", "-", "<<", "<=>", "==", "[]", "[]=", "assoc", "at", "clear", "collect", "collect!", "compact", "compact!", "concat", "delete", "delete_at", "delete_if", "each", "each_index", "empty?", "eql?", "fetch", "fill", "first", "flatten", "flatten!", "frozen?", "hash", "include?", "index", "indexes", "indices", "insert", "inspect", "join", "last", "length", "map", "map!", "nitems", "pack", "pop", "push", "rassoc", "reject", "reject!", "replace", "reverse", "reverse!", "reverse_each", "rindex", "select", "shift", "size", "slice", "slice!", "sort", "sort!", "to_a", "to_ary", "to_s", "transpose", "uniq", "uniq!", "unshift", "values_at", "zip", "|"] I suppose it was done that way for optimization. Why do you need to subclass Array, anyway? Daniel