Skip to content

Commit

Permalink
2-0-stable: Add OrderedHash#to_hash References rails#11266 [josh]
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/2-0-stable@8973 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
NZKoz committed Mar 3, 2008
1 parent 0a1deae commit 0e57097
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions activesupport/lib/active_support/ordered_options.rb
Expand Up @@ -26,6 +26,12 @@ def keys
def values
collect { |key, value| value }
end

def to_hash
returning({}) do |hash|
each { |array| hash[array[0]] = array[1] }
end
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions activesupport/test/core_ext/enumerable_test.rb
Expand Up @@ -22,6 +22,7 @@ def test_group_by
end

assert_equal objects.uniq.map(&:name), grouped.keys
assert({}.merge(grouped), "Could not convert ActiveSupport::OrderedHash into Hash")
end

def test_sums
Expand Down

0 comments on commit 0e57097

Please sign in to comment.