Module: Mongoid::Criteria::Queryable::Extensions::Object
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Defined in: | lib/mongoid/criteria/queryable/extensions/object.rb |
Overview
Adds query type-casting behavior to Object class.
Instance Attribute Summary
- #regexp? ⇒ false readonly deprecated Deprecated.
Instance Method Summary
-
#__add__(object) ⇒ Object
Combine the two objects using the add strategy.
-
#__add_from_array__(array) ⇒ Array
Merge this object into the provided array.
-
#__array__ ⇒ Array
Get the object as an array.
-
#__deep_copy__ ⇒ Object
Deep copy the object.
-
#__expand_complex__ ⇒ Object
Get the object as expanded.
-
#__intersect__(object) ⇒ Array
Combine the two objects using the intersect strategy.
-
#__intersect_from_array__(array) ⇒ Array
Merge this object into the provided array.
-
#__intersect_from_object__(object) ⇒ Array
Merge this object into the provided array.
-
#__union__(object) ⇒ Array
Combine the two objects using the union strategy.
-
#__union_from_object__(object) ⇒ Array
Merge this object into the provided array.
Instance Attribute Details
#regexp? ⇒ false (readonly)
Is the object a regex.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 131
def regexp? false end
Instance Method Details
#__add__(object) ⇒ Object
Combine the two objects using the add strategy.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 17
def __add__(object) (object == self) ? self : [ self, object ].flatten.uniq end
#__add_from_array__(array) ⇒ Array
Merge this object into the provided array.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 29
def __add_from_array__(array) array.concat(Array(self)).uniq end
#__array__ ⇒ Array
Get the object as an array.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 110
def __array__ [ self ] end
#__deep_copy__ ⇒ Object
Deep copy the object. This is for API compatibility, but needs to be overridden.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 100
def __deep_copy__ self end
#__expand_complex__ ⇒ Object
Get the object as expanded.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 120
def self end
#__intersect__(object) ⇒ Array
Combine the two objects using the intersect strategy.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 41
def __intersect__(object) object.__intersect_from_object__(self) end
#__intersect_from_array__(array) ⇒ Array
Merge this object into the provided array.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 53
def __intersect_from_array__(array) array & Array(self) end
#__intersect_from_object__(object) ⇒ Array
Merge this object into the provided array.
#__union__(object) ⇒ Array
Combine the two objects using the union strategy.
# File 'lib/mongoid/criteria/queryable/extensions/object.rb', line 77
def __union__(object) object.__union_from_object__(self) end
#__union_from_object__(object) ⇒ Array
Merge this object into the provided array.