模块:Mongoid::Matcher::FieldOperator Private

定义于:
lib/mongoid/matcher/field_operator.rb

Overview

该模块是私有 API 的一部分。 您应尽可能避免使用此模块,因为它将来可能会被删除或更改。

Singleton 模块提供与字段值相关的查询运算符匹配器的查找。

常量摘要折叠

MAP =

此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。

{
  ' $all ' => 所有,
  '$bitsAllClear' => BitsAllClear,
  ' $bitsAllSet ' => BitsAllSet,
  ' $bitsAnyClear ' => BitsAnyClear,
  '$bitsAnySet' => BitsAnySet,
  '$elemMatch' => ElemMatch,
  '$eq' => 等式,
  ' $exists ' => Exists,
  '$gt' => GT,
  '$gte' => gte,
  ' $in ' => 登录,
  '$lt' => lt,
  ' $lte ' => lte,
  '$mod' => Mod,
  '$nin' => nin,
  '$ne' => ne,
  ' $not ' => not,
  ' $regex ' => 正则表达式(Regex),
  ' $size ' => size,
  '$type' => 类型,
}.冻结

类方法摘要折叠

类方法详细信息

apply_array_field_operator (exists, value,condition) ⇒对象

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

TODO:

对其进行重构,因为它仅与 $lt、$lte、$gt、$gte 相关。

用于评估 $lt、$lte、$gt、$gte 比较操作符。



54
55
56
57
58
59
60
# File 'lib/mongoid/matcher/field_operator.rb', line 54

module_function def apply_array_field_operator(存在, , 条件)
  if 阵列 === 
    .任何? { |v| 产量 v }
  else
    产量 
  end
end

apply_comparison_operator (操作符, left, right) ⇒对象

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

TODO:

对其进行重构,因为它仅与 $lt、$lte、$gt、$gte 相关。

用于评估 $lt、$lte、$gt、$gte 比较操作符。



67
68
69
70
71
72
73
74
75
# File 'lib/mongoid/matcher/field_operator.rb', line 67

module_function def apply_comparison_operator(运算符, 向左, )
  向左.发送(运算符, )
救援 ArgumentError, NoMethodError, TypeError
  # 我们压制虚假的比较尝试,例如 数字转string
  # 个比较。
  # 根据类型的不同,可能会产生几种不同的异常
  # 涉及。
  false
end

.get(op) ⇒ Module

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回给定操作符的匹配器模块。

参数:

  • op ( string )

    操作符名称。

返回:

  • (模块)

    匹配器模块。



43
44
45
46
47
# File 'lib/mongoid/matcher/field_operator.rb', line 43

module_function def 获取(op)
  映射(map).获取(op)
救援 KeyError
  提高 Errors::InvalidFieldOperator.new(op)
end