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.
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 |
# File 'lib/parse/query/constraints.rb', line 1096 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.
1092 |
# File 'lib/parse/query/constraints.rb', line 1092 constraint_keyword :$exists |