Class: Parse::Constraint::ContainsAllConstraint
- Inherits:
-
Parse::Constraint
- Object
- Parse::Constraint
- Parse::Constraint::ContainsAllConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
Equivalent to the $all Parse query operation. Checks whether the value in the column field contains all of the given values provided in the array. Note that the field column should be of type Array in your Parse class.
q.where :field.all => array
q.where :array_key.all => [2,3,4]
Instance Attribute Summary
Attributes inherited from Parse::Constraint
#operand, #operation, #operator, #value
Instance Method Summary collapse
-
#all ⇒ ContainsAllConstraint
A registered method on a symbol to create the constraint.
-
#build ⇒ Hash
The compiled constraint.
-
#contains_all ⇒ ContainsAllConstraint
Alias for #all.
-
#superset_of ⇒ ContainsAllConstraint
Alias for #all - semantically clearer when checking if array is a superset.
Methods inherited from Parse::Constraint
#as_json, constraint_keyword, create, formatted_value, #formatted_value, #initialize, #key, #precedence, register, #to_s
Constructor Details
This class inherits a constructor from Parse::Constraint
Instance Method Details
#all ⇒ ContainsAllConstraint
A registered method on a symbol to create the constraint. Maps to Parse operator “$all”.
|
|
# File 'lib/parse/query/constraints.rb', line 474
|
#build ⇒ Hash
Returns the compiled constraint.
495 496 497 498 499 |
# File 'lib/parse/query/constraints.rb', line 495 def build val = formatted_value val = [val].compact unless val.is_a?(Array) { @operation.operand => { key => val } } end |
#contains_all ⇒ ContainsAllConstraint
Alias for #all
|
|
# File 'lib/parse/query/constraints.rb', line 480
|
#superset_of ⇒ ContainsAllConstraint
Alias for #all - semantically clearer when checking if array is a superset
489 |
# File 'lib/parse/query/constraints.rb', line 489 constraint_keyword :$all |