Module: Mongoid::Criteria::Queryable::Extensions::Object
- Defined in:
- build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb
Overview
This module contains additional object behavior.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#__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.
-
#regexp? ⇒ false
Is the object a regex.
Instance Method Details
#__add__(object) ⇒ Object
Combine the two objects using the add strategy.
22 23 24 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 22 def __add__(object) (object == self) ? self : [ self, object ].flatten.uniq end |
#__add_from_array__(array) ⇒ Array
Merge this object into the provided array.
36 37 38 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 36 def __add_from_array__(array) array.concat(Array(self)).uniq end |
#__array__ ⇒ Array
Get the object as an array.
129 130 131 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 129 def __array__ [ self ] end |
#__deep_copy__ ⇒ Object
Deep copy the object. This is for API compatibility, but needs to be overridden.
119 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 119 def __deep_copy__; self; end |
#__expand_complex__ ⇒ Object
Get the object as expanded.
141 142 143 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 141 def self end |
#__intersect__(object) ⇒ Array
Combine the two objects using the intersect strategy.
50 51 52 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 50 def __intersect__(object) object.__intersect_from_object__(self) end |
#__intersect_from_array__(array) ⇒ Array
Merge this object into the provided array.
64 65 66 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 64 def __intersect_from_array__(array) array & Array(self) end |
#__intersect_from_object__(object) ⇒ Array
Merge this object into the provided array.
78 79 80 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 78 def __intersect_from_object__(object) Array(object) & Array(self) end |
#__union__(object) ⇒ Array
Combine the two objects using the union strategy.
92 93 94 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 92 def __union__(object) object.__union_from_object__(self) end |
#__union_from_object__(object) ⇒ Array
Merge this object into the provided array.
106 107 108 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 106 def __union_from_object__(object) (Array(object) + Array(self)).uniq end |
#regexp? ⇒ false
Is the object a regex.
153 154 155 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/object.rb', line 153 def regexp? false end |