On Jul 30, 2006, at 2:24 PM, Chad Perrin wrote:

> On Mon, Jul 31, 2006 at 01:10:04AM +0900, Charles Hoffman wrote:
>> irb(main):003:0> h.sort
>> => [["car", 12], ["five", 3], ["horse", 5], ["pig", 7]]
>>
>> Sure enough... returns an nX2 array whose rows are key, value, and
>> sorted by key.
>>
>> Doesn't work when your keys are symbols, though:
>
> That would explain why I thought .sort didn't work with hashes.
>

hash.sort_by{ |k,v| k.to_s }


> -- 
> CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
> Brian K. Reid: "In computer science, we stand on each other's feet."
>