Class: Parse::Constraint::ContainedByConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- Parse::Constraint::ContainedByConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
Equivalent to the $containedBy Parse query operation. Matches documents where the array field's values are all within the supplied set (the inverse of ContainsAllConstraint: the field must be a subset of the provided array). The field column should be of type Array in your Parse class.
q.where :field.contained_by => [1, 2, 3] q.where :tags.contained_by => ["ruby", "rails", "parse"]
Instance Method Summary collapse
-
#build ⇒ Hash
The compiled constraint.
-
#contained_by ⇒ ContainedByConstraint
A registered method on a symbol to create the constraint.
Instance Method Details
#build ⇒ Hash
Returns the compiled constraint.
524 525 526 527 528 |
# File 'lib/parse/query/constraints.rb', line 524 def build val = formatted_value val = [val].compact unless val.is_a?(Array) { @operation.operand => { key => val } } end |
#contained_by ⇒ ContainedByConstraint
A registered method on a symbol to create the constraint. Maps to Parse operator "$containedBy".
520 |
# File 'lib/parse/query/constraints.rb', line 520 constraint_keyword :$containedBy |