aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-13 21:06:07 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-13 21:06:07 -0700
commitab1a66153360231e60c2c115aff599dcd314e309 (patch)
treea73cb497a61f92ca04abfde4750b5b3e6e97d8f2
parent9c53e82d66d0c34b8f35609b7972f28521d5794d (diff)
downloadrails-ab1a66153360231e60c2c115aff599dcd314e309.tar.gz
rails-ab1a66153360231e60c2c115aff599dcd314e309.tar.bz2
rails-ab1a66153360231e60c2c115aff599dcd314e309.zip
Revert "speeding up flattened version of OrderedHash.[]"
This reverts commit 9c53e82d66d0c34b8f35609b7972f28521d5794d.
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index 491cfdcf77..4adfaecd4a 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -64,8 +64,9 @@ module ActiveSupport
raise ArgumentError.new("odd number of arguments for Hash")
end
- 0.step(args.length, 2) do |ind|
- ordered_hash[args[ind]] = args[ind + 1]
+ args.each_with_index do |val, ind|
+ next if (ind % 2 != 0)
+ ordered_hash[val] = args[ind + 1]
end
ordered_hash