Module: Origin::Extensions::Numeric
- Defined in:
- lib/origin/extensions/numeric.rb
Overview
This module contains additional numeric behaviour.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#__evolve_date__ ⇒ Time
Evolve the numeric value into a mongo friendly date, aka UTC time at midnight.
-
#__evolve_time__ ⇒ Time
Evolve the numeric value into a mongo friendly time.
-
#to_direction ⇒ Integer
Get the integer as a sort direction.
Instance Method Details
#__evolve_date__ ⇒ Time
Evolve the numeric value into a mongo friendly date, aka UTC time at midnight.
17 18 19 20 |
# File 'lib/origin/extensions/numeric.rb', line 17 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.
30 31 32 |
# File 'lib/origin/extensions/numeric.rb', line 30 def __evolve_time__ ::Time.at(self).utc end |
#to_direction ⇒ Integer
Get the integer as a sort direction.
42 |
# File 'lib/origin/extensions/numeric.rb', line 42 def to_direction; self; end |