Method: Mongoid::Scope#initialize

Defined in:
lib/mongoid/scope.rb

#initialize(conditions = {}, &block) ⇒ Scope

Create the new Scope. If a block is passed in, this Scope will store the block for future calls to #extend.

Examples:

Create a new scope.

Scope.new(:title => "Sir")

Parameters:

  • conditions (Hash) (defaults to: {})

    The scoping limitations.



14
15
16
17
# File 'lib/mongoid/scope.rb', line 14

def initialize(conditions = {}, &block)
  @conditions = conditions
  @extensions = Module.new(&block) if block_given?
end