Martin DeMello
12/3/2006 11:19:00 AM
On 12/3/06, chen li <chen_li3@yahoo.com> wrote:
> ##
> require 'win32ole'
> excel = WIN32OLE.new('Excel.Application')
> m = excel.ole_methods
> p m.class
> p m.sort
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