Sha256: 7d53ad7466efb0fc967602bec223b907efa272614de4662df9f5c40054f25808
Contents?: true
Size: 609 Bytes
Versions: 8
Compression:
Stored size: 609 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: class Scope #:nodoc: attr_reader :conditions, :extensions # Create the new +Scope+. If a block is passed in, this Scope will store # the block for future calls to #extend. # # Options: # # conditions: A +Hash+ of conditions. # block: A +block+ of extension methods (optional) # def initialize(conditions = {}, &block) @conditions = conditions @extensions = Module.new(&block) if block_given? end def extend(criteria) @extensions ? criteria.extend(@extensions) : criteria end end end
Version data entries
8 entries across 8 versions & 1 rubygems