Column sort (Noobie question)

P

Pablo Tejada

I am write a program to sort pictures, I can read in the directory and
rename the picture basied on the exif information but I now want to do
load the directory and exif timestamp into a two column table and then
sort. I have searched for a multi column array or table but have not
found an example. Any suggestions?

Thanks,

-Pablo
 
B

Bira

I am write a program to sort pictures, I can read in the directory and
rename the picture basied on the exif information but I now want to do
load the directory and exif timestamp into a two column table and then
sort. I have searched for a multi column array or table but have not
found an example. Any suggestions?

You could probably use an array of arrays, and the sort_by method.
This sorts a two-column table by name:

table = [['name03',<timestamp>], ['name02',<timestamp>], ['name01',<timestamp>]]

table.sort_by { |element| element[0] }

The above example is not "real" Ruby code because of the "<timestamp>"
thingies, but it should work if you use it with your real data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,211
Messages
2,571,092
Members
47,693
Latest member
david4523

Latest Threads

Top