J
joe.yakich
Imagine I have this data structure:
@my_hash[8858]['name'] = 'goober'
@my_hash[8858]['sort_date'] = 19991231
@my_hash[2004]['name'] = 'goober'
@my_hash[2004]['sort_date'] = '20010416'
@my_hash[8872]['name'] = 'pyle'
@my_hash[8872]['sort_date'] = '20010416'
@my_hash[89]['name'] = 'hogan'
@my_hash[89]['sort_date'] = '2004 0918'
@my_hash[9]['name'] = 'homer'
@my_hash[9]['sort_date'] = '19980718'
How does one sort it first by the name value, then by the sort_date
value? (So that the name == 'goober' items appear before the others,
and the very first element returned by the sort would be
@my_hash[8858]?)
I tried searching a bit (the FAQ and google) , but came up empty; sorry
if this is a noob question. (Although, I am a ruby noob, so...)
TIA!
Joe
@my_hash[8858]['name'] = 'goober'
@my_hash[8858]['sort_date'] = 19991231
@my_hash[2004]['name'] = 'goober'
@my_hash[2004]['sort_date'] = '20010416'
@my_hash[8872]['name'] = 'pyle'
@my_hash[8872]['sort_date'] = '20010416'
@my_hash[89]['name'] = 'hogan'
@my_hash[89]['sort_date'] = '2004 0918'
@my_hash[9]['name'] = 'homer'
@my_hash[9]['sort_date'] = '19980718'
How does one sort it first by the name value, then by the sort_date
value? (So that the name == 'goober' items appear before the others,
and the very first element returned by the sort would be
@my_hash[8858]?)
I tried searching a bit (the FAQ and google) , but came up empty; sorry
if this is a noob question. (Although, I am a ruby noob, so...)
TIA!
Joe