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