From f962fb70a07722483d4443d40805e6e2dd791fa1 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 28 Jul 2010 08:55:11 -0700 Subject: defining a list of predicate methods for easy metaprogramming --- lib/arel/algebra/attributes/attribute.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/arel') 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 -- cgit v1.2.3