Just remember that if you 'sort' a hash, you get an *array* not a hash.  You
may need to adjust your code to match.  That's tripped me up before.


On 12/06/07, Chris McMahon wrote:

> So here's the question: Why aren't the csv results in the order of the
hash?
> And what order /are/ they in? There seems to be some method to the
madness
> here, because they come out consistently in the /same/ order...but it
isn't
> the order they are listed in the hash, or alphabetical by key or
> value...anyone know how this works?

Hashes are not sorted in predictable ways, regardless of which
language you're using.  Luckily, in Ruby, the Hash object has a sort()
method:  http://www.rubycentral.com/book/ref_c_hash.html#Hash.sort

I'm not a huge expert at this stuff, but I've tripped over it before.

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to