Module: Mongoid::Criteria::Queryable::Mergeable

Included in:
Mongoid::Criteria::Queryable
Defined in:
build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb

Overview

Contains behavior for merging existing selection with new selection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#strategyObject

Returns the value of attribute strategy.



12
13
14
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb', line 12

def strategy
  @strategy
end

#strategy The name of the current strategy.(Thenameofthecurrentstrategy.) ⇒ Object



12
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb', line 12

attr_accessor :strategy

Instance Method Details

#intersectMergeable

Instruct the next mergeable call to use intersection.

Examples:

Use intersection on the next call.

mergeable.intersect.in(field: [ 1, 2, 3 ])

Returns:

  • (Mergeable)

    The intersect flagged mergeable.

Since:

  • 1.0.0



22
23
24
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb', line 22

def intersect
  use(:__intersect__)
end

#overrideMergeable

Instruct the next mergeable call to use override.

Examples:

Use override on the next call.

mergeable.override.in(field: [ 1, 2, 3 ])

Returns:

  • (Mergeable)

    The override flagged mergeable.

Since:

  • 1.0.0



34
35
36
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb', line 34

def override
  use(:__override__)
end

#reset_strategies!Criteria

Clear the current strategy and negating flag, used after cloning.

Examples:

Reset the strategies.

mergeable.reset_strategies!

Returns:

Since:

  • 1.0.0



58
59
60
61
62
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb', line 58

def reset_strategies!
  self.strategy = nil
  self.negating = nil
  self
end

#unionMergeable

Instruct the next mergeable call to use union.

Examples:

Use union on the next call.

mergeable.union.in(field: [ 1, 2, 3 ])

Returns:

  • (Mergeable)

    The union flagged mergeable.

Since:

  • 1.0.0



46
47
48
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/mergeable.rb', line 46

def union
  use(:__union__)
end