aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorKen Collins <ken@metaskills.net>2009-05-09 18:35:31 -0400
committerMichael Koziarski <michael@koziarski.com>2009-05-10 13:04:46 +1200
commit9e0cfdb7f951c0446cdfd3b2cc26443712fe657a (patch)
tree9bc96bd5c72b891b491f49a908108fa94b838fed /activesupport/lib
parent235775de291787bba6b7bc3c58e791216c3b5090 (diff)
downloadrails-9e0cfdb7f951c0446cdfd3b2cc26443712fe657a.tar.gz
rails-9e0cfdb7f951c0446cdfd3b2cc26443712fe657a.tar.bz2
rails-9e0cfdb7f951c0446cdfd3b2cc26443712fe657a.zip
ActiveSupport::OrderedHash#to_a method returns an ordered set of arrays. Matches ruby1.9's Hash#to_a.
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#2629 state:committed]
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index fed8094a24..33fd2a29b9 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -57,6 +57,10 @@ module ActiveSupport
self
end
+ def to_a
+ @keys.map { |key| [ key, self[key] ] }
+ end
+
def each_key
@keys.each { |key| yield key }
end