Class: CDQ::CDQPartialPredicate

Inherits:
CDQObject show all
Defined in:
motion/cdq/partial_predicate.rb,
motion/cdq.rb

Overview

A partial predicate is an intermediate state while constructing a query. It knows which attribute to use as the left operand, and then offers a range of methods to specify which operation to use, and what value to use as the right operand. They are most commonly created via the where, and, and or methods on query, and sometimes via the main cdq method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CDQObject

#background, #contexts, #find, #models, #reset!, #save, #setup, #stores

Methods included from CDQ

#cdq

Constructor Details

#initialize(key, scope, operation = :and) ⇒ CDQPartialPredicate

Returns a new instance of CDQPartialPredicate.


15
16
17
18
19
# File 'motion/cdq/partial_predicate.rb', line 15

def initialize(key, scope, operation = :and)
  @key = key
  @scope = scope
  @operation = operation
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key


13
14
15
# File 'motion/cdq/partial_predicate.rb', line 13

def key
  @key
end

#operationObject (readonly)

Returns the value of attribute operation


13
14
15
# File 'motion/cdq/partial_predicate.rb', line 13

def operation
  @operation
end

#scopeObject (readonly)

Returns the value of attribute scope


13
14
15
# File 'motion/cdq/partial_predicate.rb', line 13

def scope
  @scope
end

Instance Method Details

#begins_with(substr, options = 0) ⇒ Object

Begins With String


59
# File 'motion/cdq/partial_predicate.rb', line 59

def begins_with(substr, options = 0); make_scope(NSBeginsWithPredicateOperatorType, substr, options); end

#between(min, max) ⇒ Object

Between Min and Max Values


67
# File 'motion/cdq/partial_predicate.rb', line 67

def between(min, max);                make_scope(NSBetweenPredicateOperatorType, [min, max]); end

#contains(substr, options = 0) ⇒ Object Also known as: include

Contains Substring


47
# File 'motion/cdq/partial_predicate.rb', line 47

def contains(substr, options = 0);    make_scope(NSContainsPredicateOperatorType, substr, options); end

#ends_with(substr, options = 0) ⇒ Object

Ends With String


63
# File 'motion/cdq/partial_predicate.rb', line 63

def ends_with(substr, options = 0);   make_scope(NSEndsWithPredicateOperatorType, substr, options); end

#eq(value, options = 0) ⇒ Object Also known as: equal

Equality


23
# File 'motion/cdq/partial_predicate.rb', line 23

def eq(value, options = 0);           make_scope(NSEqualToPredicateOperatorType, value, options); end

#ge(value, options = 0) ⇒ Object Also known as: greater_than_or_equal

Greater Than or Equal To


43
# File 'motion/cdq/partial_predicate.rb', line 43

def ge(value, options = 0);           make_scope(NSGreaterThanOrEqualToPredicateOperatorType, value, options); end

#gt(value, options = 0) ⇒ Object Also known as: greater_than

Greater Than


39
# File 'motion/cdq/partial_predicate.rb', line 39

def gt(value, options = 0);           make_scope(NSGreaterThanPredicateOperatorType, value, options); end

#in(list, options = 0) ⇒ Object

List membership


55
# File 'motion/cdq/partial_predicate.rb', line 55

def in(list, options = 0);            make_scope(NSInPredicateOperatorType, list, options); end

#le(value, options = 0) ⇒ Object Also known as: less_than_or_equal

Less Than or Equal To


35
# File 'motion/cdq/partial_predicate.rb', line 35

def le(value, options = 0);           make_scope(NSLessThanOrEqualToPredicateOperatorType, value, options); end

#lt(value, options = 0) ⇒ Object Also known as: less_than

Less Than


31
# File 'motion/cdq/partial_predicate.rb', line 31

def lt(value, options = 0);           make_scope(NSLessThanPredicateOperatorType, value, options); end

#matches(regexp, options = 0) ⇒ Object

Matches Regexp


51
# File 'motion/cdq/partial_predicate.rb', line 51

def matches(regexp, options = 0);     make_scope(NSMatchesPredicateOperatorType, regexp, options); end

#ne(value, options = 0) ⇒ Object Also known as: not_equal

Inequality


27
# File 'motion/cdq/partial_predicate.rb', line 27

def ne(value, options = 0);           make_scope(NSNotEqualToPredicateOperatorType, value, options); end