diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 18:27:58 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 18:27:58 -0700 |
commit | 181f4633b8aff0efdff6643ddee800d6f78d1eac (patch) | |
tree | 822b8c400c844cfac0503d1b4af446e65880dd32 | |
parent | bc4d913200d17da751f9b1d9bad78cb94173a4cb (diff) | |
download | rails-181f4633b8aff0efdff6643ddee800d6f78d1eac.tar.gz rails-181f4633b8aff0efdff6643ddee800d6f78d1eac.tar.bz2 rails-181f4633b8aff0efdff6643ddee800d6f78d1eac.zip |
inject is slow, lets use Hash[] and map {}
-rw-r--r-- | lib/arel/algebra/core_extensions/hash.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/arel/algebra/core_extensions/hash.rb b/lib/arel/algebra/core_extensions/hash.rb index 82cd5e11d3..4b36a3e2bc 100644 --- a/lib/arel/algebra/core_extensions/hash.rb +++ b/lib/arel/algebra/core_extensions/hash.rb @@ -1,7 +1,7 @@ class Hash def bind(relation) - inject({}) do |bound, (key, value)| - bound.merge(key.bind(relation) => value.bind(relation)) - end + Hash[map { |key, value| + [key.bind(relation), value.bind(relation)] + }] end end |