Module: Mongoid::Extensions::Range

Defined in:
lib/mongoid/extensions/range.rb

Overview

Adds type-casting behavior to Range class.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/mongoid/extensions/range.rb', line 7

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#__find_args__Array

Deprecated.

Get the range as arguments for a find.

Examples:

Get the range as find args.

range.__find_args__

Returns:

  • (Array)

    The range as an array.



18
19
20
# File 'lib/mongoid/extensions/range.rb', line 18

def __find_args__
  to_a
end

#mongoizeHash | nil

Turn the object from the ruby type we deal with to a Mongo friendly type.

Examples:

Mongoize the object.

range.mongoize

Returns:

  • (Hash | nil)

    The object mongoized or nil.



30
31
32
# File 'lib/mongoid/extensions/range.rb', line 30

def mongoize
  ::Range.mongoize(self)
end

#resizable?true

Is this a resizable object.

Examples:

Is this resizable?

range.resizable?

Returns:

  • (true)

    True.



40
41
42
# File 'lib/mongoid/extensions/range.rb', line 40

def resizable?
  true
end