diff options
author | Ken Collins <ken@metaskills.net> | 2009-05-09 18:35:31 -0400 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-05-10 13:04:46 +1200 |
commit | 9e0cfdb7f951c0446cdfd3b2cc26443712fe657a (patch) | |
tree | 9bc96bd5c72b891b491f49a908108fa94b838fed /activesupport/lib/active_support | |
parent | 235775de291787bba6b7bc3c58e791216c3b5090 (diff) | |
download | rails-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/active_support')
-rw-r--r-- | activesupport/lib/active_support/ordered_hash.rb | 4 |
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 |