On Thu, Jul 14, 2011 at 4:03 PM, Alexey Muranov <
muranov / math.univ-toulouse.fr> wrote:

> Hello,
> i know that in Ruby 1.9 Hash is ordered, but it seems to be a
> controversial solution.
> Does there exist by any chance any standard library with an OrderedHash
> class?
> I would prefer to call ordered hash an OrderedHash, rather than Hash.
>
> I saw that there existed ActiveSupport::OrderedHash in Rails, but its
> API page recently disappeared...
>

Yes, it has been marked with the #:nodoc: rdoc tag(?) so it is now omitted
from the documentation. If I were you I'd go ask the guys in the "Ruby on
Rails: Core" mailing-list/group (
https://groups.google.com/forum/#!forum/rubyonrails-core) if you can expect
the class to stick around (and/or why it's been nodoc-ed). After all, since
your project is a rails one you're right to look to leverage this
ActiveSupport class.


>
> I think by the way that the current ordered implementation of Hash is
> nice, but should have been called OrderedHash, so that in future
> versions Hash could be made unordered again.
>

Or it is named correctly and you can just assume a Hash isn't ordered (even
if it is for a specific version) and code accordingly. Or just copy or fork
ActiveSupport::OrderedHash for your own needs in your own project:

https://github.com/rails/rails/blob/master/activesupport/lib/active_support/ordered_hash.rb

-- 
Kendall Gifford
zettabyte / gmail.com