diff options
author | Ernie Miller <ernie@metautonomo.us> | 2010-03-30 09:52:22 -0400 |
---|---|---|
committer | Ernie Miller <ernie@metautonomo.us> | 2010-05-07 13:05:55 -0400 |
commit | 0afcfa27c9f386ca7c190cd1f66db1cdd9971f3b (patch) | |
tree | cbb3edb878cdf7786705c4c586f1c23751cadb0b /lib/arel/algebra | |
parent | 7e7a3548bb7e024b0bac0a03e3ac9f774c3486d4 (diff) | |
download | rails-0afcfa27c9f386ca7c190cd1f66db1cdd9971f3b.tar.gz rails-0afcfa27c9f386ca7c190cd1f66db1cdd9971f3b.tar.bz2 rails-0afcfa27c9f386ca7c190cd1f66db1cdd9971f3b.zip |
Rename Attribute Not -> Inequality and add a Not predicate (complement)
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/attributes/attribute.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/predicates.rb | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb index 5689d69b02..0266b38db3 100644 --- a/lib/arel/algebra/attributes/attribute.rb +++ b/lib/arel/algebra/attributes/attribute.rb @@ -84,7 +84,7 @@ module Arel module Predications methods = { :eq => "Equality", - :not => "Not", + :noteq => "Inequality", :lt => "LessThan", :lteq => "LessThanOrEqualTo", :gt => "GreaterThan", diff --git a/lib/arel/algebra/predicates.rb b/lib/arel/algebra/predicates.rb index ea1f771abb..43606139b0 100644 --- a/lib/arel/algebra/predicates.rb +++ b/lib/arel/algebra/predicates.rb @@ -8,6 +8,10 @@ module Arel def and(other_predicate) And.new(self, other_predicate) end + + def not + Not.new(self) + end end class Grouped < Predicate @@ -35,6 +39,11 @@ module Arel a2.inject({}) { |h,e| h[e] = a2.select { |i| i == e }.size; h } end end + + class Unary < Predicate + attributes :operand + deriving :initialize, :== + end class Binary < Predicate attributes :operand1, :operand2 @@ -59,7 +68,7 @@ module Arel end end - class Not < Equality; end + class Inequality < Equality; end class GreaterThanOrEqualTo < Binary; end class GreaterThan < Binary; end class LessThanOrEqualTo < Binary; end |