Class: Parse::Constraint::ContainsAllConstraint

Inherits:
Constraint
  • Object
show all
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 Method Summary collapse

Instance Method Details

#all ⇒ ContainsAllConstraint

A registered method on a symbol to create the constraint. Maps to Parse operator "$all".

Examples:

q.where :field.all => array

Returns:



# File 'lib/parse/query/constraints.rb', line 1212

#build ⇒ Hash

Returns the compiled constraint.

Returns:

  • (Hash) —

    the compiled constraint.



1233
1234
1235
1236
# File 'lib/parse/query/constraints.rb', line 1233

def build
  val = list_value
  { @operation.operand => { key => val } }
end

#contains_all ⇒ ContainsAllConstraint

Alias for #all



# File 'lib/parse/query/constraints.rb', line 1218

#superset_of ⇒ ContainsAllConstraint

Alias for #all - semantically clearer when checking if array is a superset

Examples:

q.where :tags.superset_of => ["rock"]  # contains at least "rock" (and possibly more)

Returns:



1227
# File 'lib/parse/query/constraints.rb', line 1227

constraint_keyword :$all