Module: Mongoid::Extensions::Float

Defined in:
build/mongoid-master/lib/mongoid/extensions/float.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

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:

  • (Time | ActiveSupport::TimeWithZone)

    The time.

Since:

  • 3.0.0



16
17
18
# File 'build/mongoid-master/lib/mongoid/extensions/float.rb', line 16

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

#numeric?true

Is the float a number?

Examples:

Is the object a number?.

object.numeric?

Returns:

  • (true)

    Always true.

Since:

  • 3.0.0



28
29
30
# File 'build/mongoid-master/lib/mongoid/extensions/float.rb', line 28

def numeric?
  true
end