Class: Parse::Constraint::ContainsAllConstraint

Inherits:
Parse::Constraint 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 Attribute Summary

Attributes inherited from Parse::Constraint

#operand, #operation, #operator, #value

Instance Method Summary collapse

Methods inherited from Parse::Constraint

#as_json, contraint_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

#allContainsAllConstraint

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 373

#buildHash

Returns the compiled constraint.

Returns:

  • (Hash)

    the compiled constraint.


387
388
389
390
391
# File 'lib/parse/query/constraints.rb', line 387

def build
  val = formatted_value
  val = [val].compact unless val.is_a?(Array)
  { @operation.operand => { key => val } }
end

#contains_allContainsAllConstraint

Alias for #all


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

contraint_keyword :$all