motion/cdq/partial_predicate.rb in cdq-0.1.1 vs motion/cdq/partial_predicate.rb in cdq-0.1.2

- old
+ new

@@ -15,25 +15,25 @@ :matches => [NSMatchesPredicateOperatorType], :in => [NSInPredicateOperatorType], :begins_with => [NSBeginsWithPredicateOperatorType], :ends_with => [NSEndsWithPredicateOperatorType] } - + def initialize(key, scope, operation = :and) @key = key @scope = scope @operation = operation end OPERATORS.each do |op, (type, synonym)| - define_method(op) do |value, options = 0| + define_method(op) do |value, options = 0| make_scope(type, value, options) end alias_method synonym, op if synonym end def between(min, max); make_scope(NSBetweenPredicateOperatorType, [min, max]); end - + private def make_pred(key, type, value, options = 0) NSComparisonPredicate.predicateWithLeftExpression( NSExpression.expressionForKeyPath(key.to_s),