Module: Mongoid::Extensions::Integer

Defined in:
build/mongoid-7.4/lib/mongoid/extensions/integer.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__mongoize_time__Time | ActiveSupport::TimeWithZone

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

Examples:

Convert the integer to a time.

1335532685.__mongoize_time__

Returns:

  • (Time | ActiveSupport::TimeWithZone)

    The time.



13
14
15
# File 'build/mongoid-7.4/lib/mongoid/extensions/integer.rb', line 13

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

#numeric?true

Is the integer a number?

Examples:

Is the object a number?.

object.numeric?

Returns:

  • (true)

    Always true.



23
24
25
# File 'build/mongoid-7.4/lib/mongoid/extensions/integer.rb', line 23

def numeric?
  true
end

#unconvertable_to_bson?true

Is the object not to be converted to bson on criteria creation?

Examples:

Is the object unconvertable?

object.unconvertable_to_bson?

Returns:

  • (true)

    If the object is unconvertable.



33
34
35
# File 'build/mongoid-7.4/lib/mongoid/extensions/integer.rb', line 33

def unconvertable_to_bson?
  true
end