Module: Mongoid::Criteria::Queryable::Extensions::Range
- Defined in:
- lib/mongoid/criteria/queryable/extensions/range.rb
Overview
This module contains additional range behavior.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#__array__ ⇒ Array
Get the range as an array.
-
#__evolve_date__ ⇒ Hash
Convert the range to a $gte/$lte mongo friendly query for dates.
-
#__evolve_range__(serializer: nil) ⇒ Hash
private
Convert the range to a $gte/$lte mongo friendly query.
-
#__evolve_time__ ⇒ Hash
Convert the range to a $gte/$lte mongo friendly query for times.
Instance Method Details
#__array__ ⇒ Array
Get the range as an array.
17 18 19 |
# File 'lib/mongoid/criteria/queryable/extensions/range.rb', line 17 def __array__ to_a end |
#__evolve_date__ ⇒ Hash
Convert the range to a $gte/$lte mongo friendly query for dates.
27 28 29 |
# File 'lib/mongoid/criteria/queryable/extensions/range.rb', line 27 def __evolve_date__ __evolve_range_naive__.transform_values! {|v| v&.__evolve_date__ } end |
#__evolve_range__(serializer: nil) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert the range to a $gte/$lte mongo friendly query.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mongoid/criteria/queryable/extensions/range.rb', line 51 def __evolve_range__(serializer: nil) __evolve_range_naive__.transform_values! do |value| if serializer serializer.evolve(value) else case value when Time, DateTime then value.__evolve_time__ when Date then value.__evolve_date__ else value end end end end |
#__evolve_time__ ⇒ Hash
Convert the range to a $gte/$lte mongo friendly query for times.
37 38 39 |
# File 'lib/mongoid/criteria/queryable/extensions/range.rb', line 37 def __evolve_time__ __evolve_range_naive__.transform_values! {|v| v&.__evolve_time__ } end |