123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Criteria::Queryable::Extensions::Numeric

Relationships & Source Files
Namespace Children
Modules:
Defined in: lib/mongoid/criteria/queryable/extensions/numeric.rb

Overview

Adds query type-casting behavior to Numeric module and its children.

Instance Method Summary

Instance Method Details

#__evolve_date__Time

Evolve the numeric value into a mongo friendly date, aka UTC time at midnight.

Examples:

Evolve to a date.

125214512412.1123.__evolve_date__

Returns:

  • (Time)

    The time representation at UTC midnight.

[ GitHub ]

  
# File 'lib/mongoid/criteria/queryable/extensions/numeric.rb', line 19

def __evolve_date__
  time = ::Time.at(self).utc
  ::Time.utc(time.year, time.month, time.day, 0, 0, 0, 0)
end

#__evolve_time__Time

Evolve the numeric value into a mongo friendly time.

Examples:

Evolve to a time.

125214512412.1123.__evolve_time__

Returns:

  • (Time)

    The time representation.

[ GitHub ]

  
# File 'lib/mongoid/criteria/queryable/extensions/numeric.rb', line 30

def __evolve_time__
  ::Time.at(self).utc
end