Hi, all,

I have subclassed Array to add some features. I am redefining sort_by so 
that it does not return an Array but a Pairs (my subclass), but I cannot 
get the syntax for passing the blocks right.

Here's my code:

   class Pairs < Array
     def initialize(ary)
       self.replace(ary)
     end

     alias_method :sort_by_old, :sort_by
     # PROBLEM here:
     def sort_by(&block)
       ary = self.sort_by_old {yield(block)}
       Pairs.new(ary)
     end
   end

I just want Pairs#sort_by to return a Pairs object every time it is 
called. Could anybody help me?

Thanks,
Dan