Module: Mongoid::Contextual::Queryable

Included in:
Memory, Mongo, None
Defined in:
lib/mongoid/contextual/queryable.rb

Overview

Mixin module which adds methods to Mongoid::Criteria that indicate the criteria query result will be an empty set.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



14
15
16
# File 'lib/mongoid/contextual/queryable.rb', line 14

def collection
  @collection
end

#collection The collection to query against.(Thecollectiontoqueryagainst.) ⇒ Object (readonly)



14
# File 'lib/mongoid/contextual/queryable.rb', line 14

attr_reader :collection, :criteria, :klass

#criteriaObject (readonly)

Returns the value of attribute criteria.



14
15
16
# File 'lib/mongoid/contextual/queryable.rb', line 14

def criteria
  @criteria
end

#criteria The criteria for the context.(Thecriteria) ⇒ Object (readonly)



14
# File 'lib/mongoid/contextual/queryable.rb', line 14

attr_reader :collection, :criteria, :klass

#klassObject (readonly)

Returns the value of attribute klass.



14
15
16
# File 'lib/mongoid/contextual/queryable.rb', line 14

def klass
  @klass
end

#klass The klass for the criteria.(Theklass) ⇒ Object (readonly)



14
# File 'lib/mongoid/contextual/queryable.rb', line 14

attr_reader :collection, :criteria, :klass

Instance Method Details

#blank?true | false Also known as: empty?

Is the enumerable of matching documents empty?

Examples:

Is the context empty?

context.blank?

Returns:

  • (true | false)

    If the context is empty.



22
23
24
# File 'lib/mongoid/contextual/queryable.rb', line 22

def blank?
  !exists?
end