模块:Mongoid::Extensions::Time

定义于:
lib/mongoid/extensions/time.rb

Overview

为 Time 类添加类型转换行为。

在命名空间下定义

模块: 类方法

实例方法摘要折叠

实例方法详细信息

# __mongoize_time__时间

将时间 Mongoizes 为时间。

Time 总是 mongoize 为 Time 实例(它们本身)。

返回:



16
17
18
# File 'lib/mongoid/extensions/time.rb', line 16

def __mongoize_time__
  self
end

# mongoize时间| nil

将对象从我们处理的Ruby类型转换为mongo友好类型。

例子:

将对象 Mongoize。

time.mongoize

返回:

  • (时间| nil )

    对象mongoized 或 nil。



27
28
29
# File 'lib/mongoid/extensions/time.rb', line 27

def mongoize
  ::时间.mongoize(self)
end