Hi all. I was hoping to get some feedback on a patch to rails/arel I've put together. Not really sure where else to get some eyes on this, since Lighthouse doesn't seem appropriate given the separation of rails/arel from rails/rails.
This patch adds support for some new types of predicates and cleans up a few small things. Tests are included.
It adds a unary predicate, Not. Predicate#not will negate the predicate on which it's called.
For example, users[:name].eq('Bob').or(users[:name].eq('Joe')).not will match users not named Joe or Bob.
Polyadic predicates are _any and _all variations on the other operations, allowing multiple right-hand operands.
For example, users[:name].matches_any(['%Joe%', '%Bob%']) will match users with names containing Joe or Bob.
There is also a cleaner implementation of support for ranges with excluded end, and a refactor to the way that predication methods are defined. While the con to using metaprogramming for this is that they would be harder to eventually document, the pro, as I see it, is that it causes someone to think twice before creating predications with one-off behavior, and instead encourages engine-specific behavior (as with the previous "range with excluded end" implementation) to be pushed to the engine instead. I tried my best to stick with the general coding style there already in Arel::ClassExtensions in doing so.
Anyway, if a few folks have some time to take a look, any feedback would be greatly appreciated.