aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/ordered_hash.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-16 14:44:57 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-16 14:44:57 -0500
commitb1dfcc968baa58d9a182ec7e129c901de0445971 (patch)
treeb81e4d48431e0ce21c1e6c0f76d21ee7802226d8 /activesupport/lib/active_support/ordered_hash.rb
parent3004bc24706ed62ea7e4e752adc287dc92d168f5 (diff)
downloadrails-b1dfcc968baa58d9a182ec7e129c901de0445971.tar.gz
rails-b1dfcc968baa58d9a182ec7e129c901de0445971.tar.bz2
rails-b1dfcc968baa58d9a182ec7e129c901de0445971.zip
update AS:OrderedHash docs
Diffstat (limited to 'activesupport/lib/active_support/ordered_hash.rb')
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index 8edd3960c7..1a3693f766 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -5,16 +5,20 @@ YAML.add_builtin_type("omap") do |type, val|
end
module ActiveSupport
- # The order of iteration over hashes in Ruby 1.8 is undefined. For example, you do not know the
- # order in which +keys+ will return keys, or +each+ yield pairs. <tt>ActiveSupport::OrderedHash</tt>
- # implements a hash that preserves insertion order, as in Ruby 1.9:
+ # <tt>ActiveSupport::OrderedHash</tt> 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
#
- # <tt>ActiveSupport::OrderedHash</tt> is namespaced to prevent conflicts with other implementations.
+ # Also, maps the +omap+ feature for YAML files
+ # (See http://yaml.org/type/omap.html) to support ordered items
+ # when loading from yaml.
+ #
+ # <tt>ActiveSupport::OrderedHash</tt> is namespaced to prevent conflicts
+ # with other implementations.
class OrderedHash < ::Hash
def to_yaml_type
"!tag:yaml.org,2002:omap"