aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-28 08:55:11 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-28 08:55:11 -0700
commitf962fb70a07722483d4443d40805e6e2dd791fa1 (patch)
tree5e1abec14b0c32de4f7ec58bf7cdb94295dd9726 /lib/arel
parentef719e021dffe03f06f8d0e34c298474d944838d (diff)
downloadrails-f962fb70a07722483d4443d40805e6e2dd791fa1.tar.gz
rails-f962fb70a07722483d4443d40805e6e2dd791fa1.tar.bz2
rails-f962fb70a07722483d4443d40805e6e2dd791fa1.zip
defining a list of predicate methods for easy metaprogramming
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/algebra/attributes/attribute.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb
index 351e553877..a59c7c3308 100644
--- a/lib/arel/algebra/attributes/attribute.rb
+++ b/lib/arel/algebra/attributes/attribute.rb
@@ -99,6 +99,21 @@ module Arel
end
include Congruence
+ PREDICATES = [
+ :eq, :eq_any, :eq_all, :not_eq, :not_eq_any, :not_eq_all, :lt, :lt_any,
+ :lt_all, :lteq, :lteq_any, :lteq_all, :gt, :gt_any, :gt_all, :gteq,
+ :gteq_any, :gteq_all, :matches, :matches_any, :matches_all, :not_matches,
+ :not_matches_any, :not_matches_all, :in, :in_any, :in_all, :not_in,
+ :not_in_any, :not_in_all
+ ]
+
+ Predicate = Class.new do
+ def instance_methods *args
+ warn "this module is deprecated, please use the PREDICATES constant"
+ PREDICATES
+ end
+ end
+
def eq(other)
Predicates::Equality.new(self, other)
end