aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-17 14:38:09 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 14:38:09 -0400
commitb0a45d52fdb7d8ce564f4dc2013bc790f98f1da3 (patch)
treee9553add3be978b3392735a40b869bfdbc53ea7a /lib/arel/algebra
parent7032a50297fce4d7724d1735e81e5df5fd919e71 (diff)
downloadrails-b0a45d52fdb7d8ce564f4dc2013bc790f98f1da3.tar.gz
rails-b0a45d52fdb7d8ce564f4dc2013bc790f98f1da3.tar.bz2
rails-b0a45d52fdb7d8ce564f4dc2013bc790f98f1da3.zip
consolidated files
Conflicts: lib/arel/algebra/predicates.rb lib/arel/algebra/relations/writes/delete.rb lib/arel/algebra/relations/writes/insert.rb lib/arel/algebra/relations/writes/update.rb lib/arel/engines/memory/predicates.rb lib/arel/engines/memory/relations.rb lib/arel/engines/sql/primitives/attribute.rb lib/arel/engines/sql/relations/writes/insert.rb lib/arel/engines/sql/relations/writes/update.rb
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r--lib/arel/algebra/predicates.rb30
-rw-r--r--lib/arel/algebra/relations.rb4
-rw-r--r--lib/arel/algebra/relations/writes.rb36
-rw-r--r--lib/arel/algebra/relations/writes/delete.rb10
-rw-r--r--lib/arel/algebra/relations/writes/insert.rb14
-rw-r--r--lib/arel/algebra/relations/writes/update.rb14
6 files changed, 50 insertions, 58 deletions
diff --git a/lib/arel/algebra/predicates.rb b/lib/arel/algebra/predicates.rb
index f83101306e..7f093ded6d 100644
--- a/lib/arel/algebra/predicates.rb
+++ b/lib/arel/algebra/predicates.rb
@@ -1,5 +1,12 @@
module Arel
class Predicate
+ def or(other_predicate)
+ Or.new(self, other_predicate)
+ end
+
+ def and(other_predicate)
+ And.new(self, other_predicate)
+ end
end
class Binary < Predicate
@@ -25,21 +32,10 @@ module Arel
end
end
- class GreaterThanOrEqualTo < Binary
- end
-
- class GreaterThan < Binary
- end
-
- class LessThanOrEqualTo < Binary
- end
-
- class LessThan < Binary
- end
-
- class Match < Binary
- end
-
- class In < Binary
- end
+ class GreaterThanOrEqualTo < Binary; end
+ class GreaterThan < Binary; end
+ class LessThanOrEqualTo < Binary; end
+ class LessThan < Binary; end
+ class Match < Binary; end
+ class In < Binary; end
end \ No newline at end of file
diff --git a/lib/arel/algebra/relations.rb b/lib/arel/algebra/relations.rb
index 03f04d2459..b75a31e5e3 100644
--- a/lib/arel/algebra/relations.rb
+++ b/lib/arel/algebra/relations.rb
@@ -2,9 +2,7 @@ require 'arel/algebra/relations/relation'
require 'arel/algebra/relations/utilities/compound'
require 'arel/algebra/relations/utilities/nil'
require 'arel/algebra/relations/utilities/externalization'
-require 'arel/algebra/relations/writes/delete'
-require 'arel/algebra/relations/writes/update'
-require 'arel/algebra/relations/writes/insert'
+require 'arel/algebra/relations/writes'
require 'arel/algebra/relations/operations/alias'
require 'arel/algebra/relations/operations/group'
require 'arel/algebra/relations/operations/join'
diff --git a/lib/arel/algebra/relations/writes.rb b/lib/arel/algebra/relations/writes.rb
new file mode 100644
index 0000000000..352f7bc7e5
--- /dev/null
+++ b/lib/arel/algebra/relations/writes.rb
@@ -0,0 +1,36 @@
+module Arel
+ class Deletion < Compound
+ attributes :relation
+ deriving :initialize, :==
+
+ def call
+ engine.delete(self)
+ end
+ end
+
+ class Insert < Compound
+ attributes :relation, :record
+ deriving :==
+
+ def initialize(relation, record)
+ @relation, @record = relation, record.bind(relation)
+ end
+
+ def call
+ engine.create(self)
+ end
+ end
+
+ class Update < Compound
+ attributes :relation, :assignments
+ deriving :==
+
+ def initialize(relation, assignments)
+ @relation, @assignments = relation, assignments.bind(relation)
+ end
+
+ def call
+ engine.update(self)
+ end
+ end
+end \ No newline at end of file
diff --git a/lib/arel/algebra/relations/writes/delete.rb b/lib/arel/algebra/relations/writes/delete.rb
deleted file mode 100644
index a94067c7fa..0000000000
--- a/lib/arel/algebra/relations/writes/delete.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module Arel
- class Deletion < Compound
- attributes :relation
- deriving :initialize, :==
-
- def call
- engine.delete(self)
- end
- end
-end
diff --git a/lib/arel/algebra/relations/writes/insert.rb b/lib/arel/algebra/relations/writes/insert.rb
deleted file mode 100644
index 6d85e9769a..0000000000
--- a/lib/arel/algebra/relations/writes/insert.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Arel
- class Insert < Compound
- attributes :relation, :record
- deriving :==
-
- def initialize(relation, record)
- @relation, @record = relation, record.bind(relation)
- end
-
- def call
- engine.create(self)
- end
- end
-end
diff --git a/lib/arel/algebra/relations/writes/update.rb b/lib/arel/algebra/relations/writes/update.rb
deleted file mode 100644
index e647218a80..0000000000
--- a/lib/arel/algebra/relations/writes/update.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Arel
- class Update < Compound
- attributes :relation, :assignments
- deriving :==
-
- def initialize(relation, assignments)
- @relation, @assignments = relation, assignments
- end
-
- def call
- engine.update(self)
- end
- end
-end