creating an OrderedHash

I’m a little confused about how one is supposed to create an ordered hash. As far as I can tell, ActiveSupport::OrderedHash does not provide a constructor or a method that can create a hash from an array of pairs. Is this a deliberate ommission? Hash also doesn’t provide this, although later versions of ruby provide .to_h on an array as a way of generating a hash. Why isn’t there an OrderedHash.from_a(<array of key, value pairs> method? Why not, perhaps, have ActiveSupport patch Array to provide a “.to_ordered_h” method on an array? If there’s an obvious way to create an ordered hash, please let me know about it, and my apologies if this has been discussed before (I couldn’t find any discussion of it myself). FWIW, my particular application was converting an ordered CsvRow to an ordered hash, which seem to involve my code than I felt should be necessary.

ActiveSupport::OrderedHash is a legacy concept. It's just the same as Hash on ruby 1.9 and above.

You can construct a hash from an array of key value pairs with Hash[array_of_pairs]