This project is archived and is in readonly mode.
[PATCH] ActiveSupport::OrderedHash#select does not preserve order
Reported by Gaius Centus Novus | October 20th, 2010 @ 12:30 AM | in 3.0.2
#select
does not preserve order, though
#find_all
does.
h = ActiveSupport::OrderedHash.new
h['one'] = '1'
h['two'] = '1'
h['three'] = '1'
h.find_all { true }
# => [["one", "1"], ["two", "2"], ["three", "3"]]
h.select { true }
# => [["three", "3"], ["two", "2"], ["one", "1"]]
Comments and changes to this ticket
-
Gaius Centus Novus October 20th, 2010 @ 12:54 AM
This probably has something to do with
Hash#select
being defined in C (on C-based Rubies, at least), whereasEnumberable#select
is just an alias forEnumberable#find_all
. I guessOrderedHash < Hash
is more powerful than a lowlyalias
in aninclude
d module. -
Gaius Centus Novus October 20th, 2010 @ 01:05 AM
- Tag changed from 2.3.8, activesupport, orderedhash to 2.3.8, activesupport, orderedhash, patch
-
Gaius Centus Novus October 20th, 2010 @ 01:05 AM
- Title changed from ActiveSupport::OrderedHash#select does not preserve order to [PATCH] ActiveSupport::OrderedHash#select does not preserve order
-
Aditya Sanghi October 20th, 2010 @ 09:41 AM
- State changed from new to verified
- Milestone set to 3.0.2
- Assigned user set to Santiago Pastorino
- Importance changed from to Low
+1 verified on 3.x/1.8.7 and 2.3.x/1.8.7
Can you please provide the patch using git format-patch as specified on the contributor's guide though?
The patch can be applied 2.3.10 branch as well as 3.0.2.
-
Gaius Centus Novus October 20th, 2010 @ 04:03 PM
- no changes were found...
-
Repository November 7th, 2010 @ 07:31 PM
- State changed from verified to resolved
(from [697f4851b8bc4eb539b3e565e8b6349cafed8aaa]) OrderedHash#select now preserves order [#5843 state:resolved]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/697f4851b8bc4eb539b3e565e8b63...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5843 [PATCH] ActiveSupport::OrderedHash#select does not preserve order (from [697f4851b8bc4eb539b3e565e8b6349cafed8aaa]) Ordered...