Class: Parse::Constraint::EmptyConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- Parse::Constraint::EmptyConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
Checks whether an array field contains any elements q.where :field.empty => true
Instance Method Summary collapse
-
#build ⇒ Hash
The compiled constraint.
-
#empty ⇒ ExistsConstraint
A registered method on a symbol to create the constraint.
Instance Method Details
#build ⇒ Hash
Returns the compiled constraint.
356 357 358 359 360 361 362 363 364 365 |
# File 'lib/parse/query/constraints.rb', line 356 def build # if nullability is equal true, then $empty should be set to false value = formatted_value unless value == true || value == false raise ArgumentError, "#{self.class}: Non-Boolean value passed, it must be either `true` or `false`" end return { "#{@operation.operand}.0" => { key => !value } } end |
#empty ⇒ ExistsConstraint
A registered method on a symbol to create the constraint.
352 |
# File 'lib/parse/query/constraints.rb', line 352 constraint_keyword :$exists |