From: Brian Candler Date: 2010-11-28T06:15:44+09:00 Subject: Re: "<" method for array Eva wrote in post #964024: > I hate there is not a "<" method for array object. If there were, I would expect it to work like this: >> class Array >> include Comparable >> end >> [1] < [2] => true >> [1] < [1] => false >> [1] < [1,0] => true > Since there is the "<<" for adding an element, why not have the "<" for > truncating then filling up the array? Array#replace already does that, except you have to give it the element also wrapped in an Array. >> a = [1,2,3] => [1, 2, 3] >> a.object_id => 69928599426960 >> a.replace [4] => [4] >> a => [4] >> a.object_id => 69928599426960 -- Posted via http://www.ruby-forum.com/.