> Hashes are by definition unordered. If you think you need an ordered hash,
> then you probably don't understand hashes...
Ruby 1.9 onwards saves the insertion order of hashes. In fact in Ruby 2.1 - a
hash of under 6 elements is stored as an array ;)
2.1.0 :001 > hsh = {'a' => 1, 'b' => 2, 'c' => 3}
=> {"a"=>1, "b"=>2, "c"=>3}
1.8.7-p374 :001 > hsh = {'a' => 1, 'b' => 2, 'c' => 3}
=> {"c"=>3, "b"=>2, "a"=>1}
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/5C16C135-C276-4F4F-881D-DF166CF1644B%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.