diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 16:33:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 16:33:23 -0700 |
commit | 33a9cdc9963489759b75102dd0df48b5a1987369 (patch) | |
tree | 0404c4cd9914218f3a57cd18bd4fdaa655d96984 /lib | |
parent | 00e39e4363c20f56ab5133743905d9d5e0ebe36c (diff) | |
download | rails-33a9cdc9963489759b75102dd0df48b5a1987369.tar.gz rails-33a9cdc9963489759b75102dd0df48b5a1987369.tar.bz2 rails-33a9cdc9963489759b75102dd0df48b5a1987369.zip |
inequality is a special case of equality
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/algebra/predicates.rb | 10 | ||||
-rw-r--r-- | lib/arel/engines/memory/predicates.rb | 2 | ||||
-rw-r--r-- | lib/arel/engines/sql/predicates.rb | 2 |
3 files changed, 4 insertions, 10 deletions
diff --git a/lib/arel/algebra/predicates.rb b/lib/arel/algebra/predicates.rb index e98e152dbd..1b9667ac13 100644 --- a/lib/arel/algebra/predicates.rb +++ b/lib/arel/algebra/predicates.rb @@ -109,7 +109,7 @@ module Arel class Equality < Binary def ==(other) - Equality === other and + self.class === other and ((operand1 == other.operand1 and operand2 == other.operand2) or (operand1 == other.operand2 and operand2 == other.operand1)) end @@ -119,13 +119,7 @@ module Arel end end - class Inequality < Binary - def ==(other) - Equality === other and - ((operand1 == other.operand1 and operand2 == other.operand2) or - (operand1 == other.operand2 and operand2 == other.operand1)) - end - + class Inequality < Equality def complement Equality.new(operand1, operand2) end diff --git a/lib/arel/engines/memory/predicates.rb b/lib/arel/engines/memory/predicates.rb index cca6739424..e36afa38c2 100644 --- a/lib/arel/engines/memory/predicates.rb +++ b/lib/arel/engines/memory/predicates.rb @@ -52,7 +52,7 @@ module Arel def operator; :== end end - class Inequality < Binary + class Inequality < Equality def eval(row) operand1.eval(row) != operand2.eval(row) end diff --git a/lib/arel/engines/sql/predicates.rb b/lib/arel/engines/sql/predicates.rb index 93d2a2f619..21d8f840c9 100644 --- a/lib/arel/engines/sql/predicates.rb +++ b/lib/arel/engines/sql/predicates.rb @@ -52,7 +52,7 @@ module Arel end end - class Inequality < Binary + class Inequality < Equality def predicate_sql operand2.inequality_predicate_sql end |