aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-06-24 09:51:23 -0300
committerEmilio Tagua <miloops@gmail.com>2010-06-24 10:01:32 -0300
commitd05fa0cc8da0ffa01333f8956acd4a24c9fd46be (patch)
treeb855b3775001c97818ba27d153887ed8c21043bc /lib/arel/algebra/relations
parent662b99528218ba7b86d45652438404012f8c4b07 (diff)
downloadrails-d05fa0cc8da0ffa01333f8956acd4a24c9fd46be.tar.gz
rails-d05fa0cc8da0ffa01333f8956acd4a24c9fd46be.tar.bz2
rails-d05fa0cc8da0ffa01333f8956acd4a24c9fd46be.zip
Improve blocks usage.
Diffstat (limited to 'lib/arel/algebra/relations')
-rw-r--r--lib/arel/algebra/relations/operations/having.rb2
-rw-r--r--lib/arel/algebra/relations/operations/lock.rb2
-rw-r--r--lib/arel/algebra/relations/operations/where.rb2
-rw-r--r--lib/arel/algebra/relations/relation.rb4
-rw-r--r--lib/arel/algebra/relations/utilities/compound.rb2
5 files changed, 6 insertions, 6 deletions
diff --git a/lib/arel/algebra/relations/operations/having.rb b/lib/arel/algebra/relations/operations/having.rb
index 0cd86c284e..a1bbbb3bdc 100644
--- a/lib/arel/algebra/relations/operations/having.rb
+++ b/lib/arel/algebra/relations/operations/having.rb
@@ -4,7 +4,7 @@ module Arel
deriving :==
requires :restricting
- def initialize(relation, *predicates, &block)
+ def initialize(relation, *predicates)
predicates = [yield(relation)] + predicates if block_given?
@predicates = predicates.map { |p| p.bind(relation) }
@relation = relation
diff --git a/lib/arel/algebra/relations/operations/lock.rb b/lib/arel/algebra/relations/operations/lock.rb
index 0d6c12e65b..2da273cebc 100644
--- a/lib/arel/algebra/relations/operations/lock.rb
+++ b/lib/arel/algebra/relations/operations/lock.rb
@@ -3,7 +3,7 @@ module Arel
attributes :relation, :locked
deriving :initialize, :==
- def initialize(relation, locked, &block)
+ def initialize(relation, locked)
@relation = relation
@locked = locked.blank? ? " FOR UPDATE" : locked
end
diff --git a/lib/arel/algebra/relations/operations/where.rb b/lib/arel/algebra/relations/operations/where.rb
index 5c50fe8640..9d868ac18b 100644
--- a/lib/arel/algebra/relations/operations/where.rb
+++ b/lib/arel/algebra/relations/operations/where.rb
@@ -4,7 +4,7 @@ module Arel
deriving :==
requires :restricting
- def initialize(relation, *predicates, &block)
+ def initialize(relation, *predicates)
predicates = [yield(relation)] + predicates if block_given?
@predicates = predicates.map { |p| p.bind(relation) }
@relation = relation
diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb
index ffd31ae470..0332482066 100644
--- a/lib/arel/algebra/relations/relation.rb
+++ b/lib/arel/algebra/relations/relation.rb
@@ -17,8 +17,8 @@ module Arel
module Enumerable
include ::Enumerable
- def each(&block)
- session.read(self).each(&block)
+ def each
+ session.read(self).each { |e| yield e }
end
def first
diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb
index 416717310c..9f653bbafb 100644
--- a/lib/arel/algebra/relations/utilities/compound.rb
+++ b/lib/arel/algebra/relations/utilities/compound.rb
@@ -47,7 +47,7 @@ module Arel
private
- def arguments_from_block(relation, &block)
+ def arguments_from_block(relation)
block_given?? [yield(relation)] : []
end
end