lib/mongoid/extensions/range.rb
# Convert the object from its mongo friendly ruby type to this type.
#
# @example Demongoize the object.
#   Range.demongoize({ "min" => 1, "max" => 5 })
#
# @param [ Hash ] object The object to demongoize.
#
# @return [ Range | nil ] The range, or nil if object cannot be represented as range.
#
# @note Ruby 2.6 and lower do not support endless ranges that Ruby 2.7+ support.
Convert the object from its mongo friendly ruby type to this type.
Convert the object from its mongo friendly ruby type to this type .
def demongoize(object)
          object.nil? ? nil : ::Range.new(object["min"], object["max"], object["exclude_end"])
        rescue ArgumentError 
          nil
        end
def demongoize ( object ) object . nil? ? nil : :: Range . new ( object [ "min" ] , object [ "max" ] , object [ "exclude_end" ] ) rescue ArgumentError nil end
Convert the object from its mongo friendly ruby type to this type.
Convert the object from its mongo friendly ruby type to this type .
# can be removed when Ruby version >= 2.7
The range, or nil if object cannot be represented as range.
The range or nil if object cannot be represented as range .
 Range | nil 
object
<not_specific>
<not_specific>
object The object to demongoize.
object The object to demongoize .
example
Demongoize the object.
Demongoize the object .
note
Ruby 2.6 and lower do not support endless ranges that Ruby 2.7+ support.
Ruby 2 . 6 and lower do not support endless ranges that Ruby 2 . 7 + support .