Module: Origin::Macroable

Included in:
Aggregable, Optional, Selectable
Defined in:
lib/origin/macroable.rb

Overview

Adds macro behaviour 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

Since:

  • 1.0.0

Parameters:

  • The name of the method.

  • The merge strategy.

  • The MongoDB operator.

  • (defaults to: nil)

    The additional MongoDB operator.



19
20
21
# File 'lib/origin/macroable.rb', line 19

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