diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-28 08:55:11 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-28 08:55:11 -0700 |
commit | f962fb70a07722483d4443d40805e6e2dd791fa1 (patch) | |
tree | 5e1abec14b0c32de4f7ec58bf7cdb94295dd9726 /lib/arel/algebra | |
parent | ef719e021dffe03f06f8d0e34c298474d944838d (diff) | |
download | rails-f962fb70a07722483d4443d40805e6e2dd791fa1.tar.gz rails-f962fb70a07722483d4443d40805e6e2dd791fa1.tar.bz2 rails-f962fb70a07722483d4443d40805e6e2dd791fa1.zip |
defining a list of predicate methods for easy metaprogramming
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/attributes/attribute.rb | 15 |
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 |