模块:Mongoid::Criteria::Queryable::Mergeable
- 定义于:
- lib/mongoid/criteria/queryable/mergeable.rb
Overview
包含将现有选择与新选择合并的行为。
实例属性摘要折叠
-
#策略⇒ 对象
返回策略属性的值。
- #策略 当前策略的名称。 (当前策略的名称。) ⇒ 对象
实例方法摘要折叠
-
# and_with_operator (criterion, Operator) ⇒ Criteria
使用 and操作符符将条件与操作符合并。
-
#相交⇒ 可合并
指示下一个可合并调用使用交集。
-
#覆盖⇒ 可合并
指示下一个可合并调用使用覆盖。
-
#reset_strategies! ⇒ Criteria
清除克隆后使用的当前策略和否定标志。
-
# union ="Mergeable"
指示下一个可合并调用使用 union。
实例属性详细信息
#策略⇒对象
返回策略属性的值。
12 13 14 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 12 def 策略 @strategy end |
#策略 当前策略的名称。 (当前策略的名称。) ⇒对象
12 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 12 attr_accessor :strategy |
实例方法详细信息
# and_with_operator (criterion, 操作符) ⇒ Criteria
使用 and操作符符将条件与操作符合并。
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 62 def and_with_operator(criterion, 运算符) Crit = self if criterion criterion.each_pair do |字段, 值| val = 准备(字段, 运算符, 值) # 准备方法已经考虑了否定。 我们 # 此处设立否定设置为 false,这样 ``and`` 也不会应用 # 否定,这样就有了double否定。 Crit.否定 = false Crit = Crit.和(字段 => val) end end Crit end |
#相交⇒可合并
指示下一个可合并调用使用交集。
20 21 22 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 20 def 相交 请使用(:__intersect__) end |
#覆盖⇒可合并
指示下一个可合并调用使用覆盖。
30 31 32 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 30 def 覆盖 请使用(:__override__) end |
#reset_strategies! ⇒ Criteria
清除克隆后使用的当前策略和否定标志。
50 51 52 53 54 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 50 def reset_strategies! self.策略 = nil self.否定 = nil self end |
# union =" Mergeable "
指示下一个可合并调用使用 union。
40 41 42 |
# File 'lib/mongoid/criteria/queryable/mergeable.rb', line 40 def 联合 (Union) 请使用(:__union__) end |