class OrderedHash

Ruby on Rails 5.2.8.1

Since v2.2.3 Last seen in v6.1.7.10

Available in: v2.2.3 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10

DEPRECATED: ActiveSupport::OrderedHash implements a hash that preserves insertion order.

oh = ActiveSupport::OrderedHash.new
oh[:a] = 1
oh[:b] = 2
oh.keys # => [:a, :b], this order is guaranteed

Also, maps the omap feature for YAML files (See yaml.org/type/omap.html) to support ordered items when loading from yaml.

ActiveSupport::OrderedHash is namespaced to prevent conflicts with other implementations.

Inherits from

Hash

Methods (defined here)

Methods (inherited)

From Hash (40)
From Object (17)

Type at least 2 characters to search.

↑↓ navigate · open · esc close