Class: Parse::Constraint::ContainedInConstraint
- Inherits:
-
Parse::Constraint
- Object
- Parse::Constraint
- Parse::Constraint::ContainedInConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
Equivalent to the β$in` Parse query operation. Checks whether the value in the column field is contained in the set of values in the target array. If the field is an array data type, it checks whether at least one value in the field array is contained in the set of values in the target array.
q.where :field.in => array
q.where :score.in => [1,3,5,7,9]
Instance Attribute Summary
Attributes inherited from Parse::Constraint
#operand, #operation, #operator, #value
Instance Method Summary collapse
- #any ⇒ ContainedInConstraint
-
#build ⇒ Hash
The compiled constraint.
- #contained_in ⇒ ContainedInConstraint
-
#in ⇒ ContainedInConstraint
A registered method on a symbol to create the constraint.
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
#any ⇒ ContainedInConstraint
392 |
# File 'lib/parse/query/constraints.rb', line 392 constraint_keyword :$in |
#build ⇒ Hash
Returns the compiled constraint.
398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/parse/query/constraints.rb', line 398 def build val = formatted_value val = [val].compact unless val.is_a?(Array) # Convert Parse objects to pointers for array contains queries if val.is_a?(Array) val = val.map do |item| item.respond_to?(:pointer) ? item.pointer : item end end { @operation.operand => { key => val } } end |
#contained_in ⇒ ContainedInConstraint
392 |
# File 'lib/parse/query/constraints.rb', line 392 constraint_keyword :$in |
#in ⇒ ContainedInConstraint
A registered method on a symbol to create the constraint. Maps to Parse operator β$inβ.
|
|
# File 'lib/parse/query/constraints.rb', line 378
|