diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 18:23:37 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 18:23:37 -0700 |
commit | a20bd2cbd19120d821e85b929fd57ea75a916c75 (patch) | |
tree | d84e61b01afdd5475cd17bdf8dbf6b51bc34b056 | |
parent | edb786204fb45ba2a877ec7a3b26e84119b13377 (diff) | |
download | rails-a20bd2cbd19120d821e85b929fd57ea75a916c75.tar.gz rails-a20bd2cbd19120d821e85b929fd57ea75a916c75.tar.bz2 rails-a20bd2cbd19120d821e85b929fd57ea75a916c75.zip |
replacing "let" with "tap"
8 files changed, 9 insertions, 13 deletions
diff --git a/lib/arel/algebra/core_extensions/object.rb b/lib/arel/algebra/core_extensions/object.rb index 85a4d951a4..2dc5ea2677 100644 --- a/lib/arel/algebra/core_extensions/object.rb +++ b/lib/arel/algebra/core_extensions/object.rb @@ -8,10 +8,6 @@ module Arel bind(relation) end - def let - yield(self) - end - Object.send(:include, self) end end diff --git a/spec/engines/memory/integration/joins/cross_engine_spec.rb b/spec/engines/memory/integration/joins/cross_engine_spec.rb index 5dc1a6cb99..091fd2ceda 100644 --- a/spec/engines/memory/integration/joins/cross_engine_spec.rb +++ b/spec/engines/memory/integration/joins/cross_engine_spec.rb @@ -24,7 +24,7 @@ module Arel .join(@photos) \ .on(@users[:id].eq(@photos[:user_id])) \ .project(@users[:name], @photos[:camera_id]) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, ['bryan', @adapter_returns_integer ? 6 : '6']), Row.new(relation, ['emilio', @adapter_returns_integer ? 42 : '42']) @@ -39,7 +39,7 @@ module Arel .join(@users) \ .on(@users[:id].eq(@photos[:user_id])) \ .project(@users[:name], @photos[:camera_id]) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, ['bryan', @adapter_returns_integer ? 6 : '6']), Row.new(relation, ['emilio', @adapter_returns_integer ? 42 : '42']) diff --git a/spec/engines/memory/unit/relations/join_spec.rb b/spec/engines/memory/unit/relations/join_spec.rb index ed5fe89ef0..9a475d817d 100644 --- a/spec/engines/memory/unit/relations/join_spec.rb +++ b/spec/engines/memory/unit/relations/join_spec.rb @@ -17,7 +17,7 @@ module Arel @relation1 \ .join(@relation2) \ .on(@relation1[:id].eq(@relation2[:id])) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [1, 'duck', 1, 'duck' ]), Row.new(relation, [2, 'duck', 2, 'duck' ]), diff --git a/spec/engines/memory/unit/relations/order_spec.rb b/spec/engines/memory/unit/relations/order_spec.rb index 9546449bfb..0d746bcd0a 100644 --- a/spec/engines/memory/unit/relations/order_spec.rb +++ b/spec/engines/memory/unit/relations/order_spec.rb @@ -14,7 +14,7 @@ module Arel it 'sorts the relation with the provided ordering' do @relation \ .order(@relation[:id].desc) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [3, 'goose']), Row.new(relation, [2, 'duck' ]), diff --git a/spec/engines/memory/unit/relations/project_spec.rb b/spec/engines/memory/unit/relations/project_spec.rb index 92ed9fa74b..3970a50129 100644 --- a/spec/engines/memory/unit/relations/project_spec.rb +++ b/spec/engines/memory/unit/relations/project_spec.rb @@ -14,7 +14,7 @@ module Arel it 'retains only the attributes that are provided' do @relation \ .project(@relation[:id]) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [1]), Row.new(relation, [2]), diff --git a/spec/engines/memory/unit/relations/skip_spec.rb b/spec/engines/memory/unit/relations/skip_spec.rb index 089db24cea..4cf6c020bc 100644 --- a/spec/engines/memory/unit/relations/skip_spec.rb +++ b/spec/engines/memory/unit/relations/skip_spec.rb @@ -14,7 +14,7 @@ module Arel it 'removes the first n rows' do @relation \ .skip(1) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [2, 'duck']), Row.new(relation, [3, 'goose']), diff --git a/spec/engines/memory/unit/relations/take_spec.rb b/spec/engines/memory/unit/relations/take_spec.rb index 16b99872c5..f74f1a74c8 100644 --- a/spec/engines/memory/unit/relations/take_spec.rb +++ b/spec/engines/memory/unit/relations/take_spec.rb @@ -14,7 +14,7 @@ module Arel it 'removes the rows after the first n' do @relation \ .take(2) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [1, 'duck']), Row.new(relation, [2, 'duck']), diff --git a/spec/engines/memory/unit/relations/where_spec.rb b/spec/engines/memory/unit/relations/where_spec.rb index b45c009d83..23aef5766e 100644 --- a/spec/engines/memory/unit/relations/where_spec.rb +++ b/spec/engines/memory/unit/relations/where_spec.rb @@ -14,7 +14,7 @@ module Arel it 'filters the relation with the provided predicate' do @relation \ .where(@relation[:id].lt(3)) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [1, 'duck']), Row.new(relation, [2, 'duck']), @@ -27,7 +27,7 @@ module Arel @relation \ .where(@relation[:id].gt(1)) \ .where(@relation[:id].lt(3)) \ - .let do |relation| + .tap do |relation| relation.call.should == [ Row.new(relation, [2, 'duck']) ] |