class Mongoid::Errors::InvalidQuery
Raised when invalid query is passed to an embedded matcher, or an invalid query fragment is passed to the query builder (Criteria
object).
Public Class Methods
Source
# File lib/mongoid/errors/invalid_query.rb, line 14 def initialize(msg) super end
Create the new invalid query error.
@api private
Calls superclass method
Source
# File lib/mongoid/errors/invalid_query.rb, line 24 def self.truncate_expr(expr) unless expr.is_a?(String) expr = expr.inspect end if expr.length > 103 expr = if expr =~ /\A<#((?:.|\n)*)>\z/ "<##{expr.slice(0, 97)}...>" else expr.slice(0, 100) + '...' end end expr end
Stringifies the argument using inspect and truncates the result to about 100 characters.
@param [ Object
] expr An expression to stringify and truncate.
@api private