123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Extensions::Float

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/mongoid/extensions/float.rb

Overview

Adds type-casting behavior to Float class.

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#numeric?true (readonly)

Is the float a number?

Examples:

Is the object a number?.

object.numeric?

Returns:

  • (true)

    Always true.

[ GitHub ]

  
# File 'lib/mongoid/extensions/float.rb', line 26

def numeric?
  true
end

Instance Method Details

#__mongoize_time__Time | ActiveSupport::TimeWithZone

Converts the float into a time as the number of seconds since the epoch.

Examples:

Convert the float into a time.

1335532685.117847.__mongoize_time__

Returns:

[ GitHub ]

  
# File 'lib/mongoid/extensions/float.rb', line 16

def __mongoize_time__
  ::Time.zone.at(self)
end