Srinivas Jonnalagadda wrote: > Dear all, > > Enumerable#select always returns an array. On a hash too, it returns > an array of arrays of key-value pairs. > > The issue with this approach is that 'select' calls cannot be chained. > It is now mandatory to know whether the receiver is the original hash > or is the result of at least one 'select'. > > Thus, for 'select'ing a second (or subsequent) time, the semantics of > the block themselves have to change. > > Else, the result of the first selection has to be manually converted > to a hash (may be using something like hsh = > Hash[select_result.flatten]). > > Is there some reason why when a filter is applied to a hash, we get an > object of a different type? > I've stumbled on the same issue yesterday and was a bit miffed, mostly because I couldn't have Hash#select! , while I can do Hash#reject! A simple reversal of logic did the trick, but the question remains. Cheers, V.- -- http://www.braveworld.net/riva ____________________________________________________________________ http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου. http://www.freemail.gr - free email service for the Greek-speaking.