lib/mongoid/matcher/size.rb in mongoid-8.1.7 vs lib/mongoid/matcher/size.rb in mongoid-9.0.0
- old
+ new
@@ -1,9 +1,25 @@
+# rubocop:todo all
module Mongoid
module Matcher
+ # In-memory matcher for $size expression.
+ #
+ # @see https://www.mongodb.com/docs/manual/reference/operator/query/size/
+ #
# @api private
module Size
+
+ # Returns whether a value satisfies a $size expression.
+ #
+ # @param [ true | false ] exists Not used.
+ # @param [ Numeric ] value The value to check.
+ # @param [ Integer | Array<Object> ] condition The $size condition
+ # predicate, either a non-negative Integer or an Array to match size.
+ #
+ # @return [ true | false ] Whether the value matches.
+ #
+ # @api private
module_function def matches?(exists, value, condition)
case condition
when Float
raise Errors::InvalidQuery, "$size argument must be a non-negative integer: #{Errors::InvalidQuery.truncate_expr(condition)}"
when Numeric