speeding up flattened version of OrderedHash.[]

This commit is contained in:
Aaron Patterson 2010-10-13 21:04:42 -07:00
parent f3f34bce8f
commit 9c53e82d66

@ -64,9 +64,8 @@ def self.[](*args)
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