1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add OrderedHash#to_hash. Closes #11266 [josh]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Michael Koziarski 2008-03-03 03:31:57 +00:00
parent b18585fb06
commit 42d1172c2d
3 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Add OrderedHash#to_hash [josh]
* Adding Time#end_of_day, _quarter, _week, and _year. #9312 [Juanjo Bazan, Tarmo Tänav, BigTitus]
* Adding TimeWithZone#between? [Geoff Buesing]

View file

@ -26,6 +26,12 @@ module ActiveSupport
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

View file

@ -22,6 +22,7 @@ class EnumerableTests < Test::Unit::TestCase
end
assert_equal objects.uniq.map(&:name), grouped.keys
assert({}.merge(grouped), "Could not convert ActiveSupport::OrderedHash into Hash")
end
def test_sums