aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/engines/memory/predicates.rb15
-rw-r--r--lib/arel/engines/sql/predicates.rb14
2 files changed, 14 insertions, 15 deletions
diff --git a/lib/arel/engines/memory/predicates.rb b/lib/arel/engines/memory/predicates.rb
index e233f3ba39..03d4f25b0a 100644
--- a/lib/arel/engines/memory/predicates.rb
+++ b/lib/arel/engines/memory/predicates.rb
@@ -1,25 +1,10 @@
module Arel
-
class Binary < Predicate
def eval(row)
operand1.eval(row).send(operator, operand2.eval(row))
end
end
- class CompoundPredicate < Binary
- def to_sql(formatter = nil)
- "(#{operand1.to_sql(formatter)} #{predicate_sql} #{operand2.to_sql(formatter)})"
- end
- end
-
- class Or < CompoundPredicate
- def predicate_sql; "OR" end
- end
-
- class And < CompoundPredicate
- def predicate_sql; "AND" end
- end
-
class Equality < Binary
def operator; :== end
end
diff --git a/lib/arel/engines/sql/predicates.rb b/lib/arel/engines/sql/predicates.rb
index 7e195c2605..b84c183c1d 100644
--- a/lib/arel/engines/sql/predicates.rb
+++ b/lib/arel/engines/sql/predicates.rb
@@ -5,6 +5,20 @@ module Arel
end
end
+ class CompoundPredicate < Binary
+ def to_sql(formatter = nil)
+ "(#{operand1.to_sql(formatter)} #{predicate_sql} #{operand2.to_sql(formatter)})"
+ end
+ end
+
+ class Or < CompoundPredicate
+ def predicate_sql; "OR" end
+ end
+
+ class And < CompoundPredicate
+ def predicate_sql; "AND" end
+ end
+
class Equality < Binary
def predicate_sql
operand2.equality_predicate_sql