Module: Mongoid::Criteria::Queryable::Macroable

Included in:
Aggregable, Optional, Selectable
Defined in:
build/mongoid-master/lib/mongoid/criteria/queryable/macroable.rb

Overview

Adds macro behavior for adding symbol methods.

Instance Method Summary collapse

Instance Method Details

#key(name, strategy, operator, additional = nil, &block) ⇒ Object

Adds a method on Symbol for convenience in where queries for the provided operators.

Examples:

Add a symbol key.

key :all, "$all

Parameters:

  • name (Symbol)

    The name of the method.

  • strategy (Symbol)

    The merge strategy.

  • operator (String)

    The MongoDB operator.

  • additional (String) (defaults to: nil)

    The additional MongoDB operator.

Since:

  • 1.0.0



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

def key(name, strategy, operator, additional = nil, &block)
  ::Symbol.add_key(name, strategy, operator, additional, &block)
end