--- Martin DeMello <martindemello / gmail.com> wrote:
> 
> sort_by is your friend. I don't have a windows
> machine handy to
> experiment, but say an Rows:WIN32OLE_METHOD defines
> a #name, you can
> say
> 
> p m.sort_by {|i| i.name}
> 
> or even
> 
> m.map {|i| i.name}.sort
> 
> if what you want is the names, rather than the
> Rows:WIN32OLE_METHOD
> objects themselves.
> 
> Of course, if you *can* print it, it evidently
> defines to_s and
> inspect methods, so this will work:
> 
> puts m.map {|i| i.to_s}.sort
> 
> or
> 
> puts m.map {|i| i.inspect}.sort
> 
> martin

Thanks and all of them work. But I just don't
understand why the line code below works

p m.sort_by {|i| i.name}

yet p m.sort.each{|i| i.name} FAILS.

Li





 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com