模块:Mongoid::Extensions::Hash::ClassMethods
- 定义于:
- lib/mongoid/extensions/hash.rb
实例方法摘要折叠
-
# mongoize (对象) ⇒ 哈希 | nil
将对象从我们处理的Ruby类型转换为mongo友好类型。
-
#可调整大小? ⇒ true
这个对象的大小可以改变吗?
实例方法详细信息
# mongoize (对象) ⇒哈希| nil
将对象从我们处理的Ruby类型转换为mongo友好类型。
123 124 125 126 127 128 129 130 131 |
# File 'lib/mongoid/extensions/hash.rb', line 123 def mongoize(对象) return if 对象.nil? 案例 对象 when BSON::文档 对象.dup.transform_values!(和:mongoize) when 哈希 BSON::文档.new(对象.transform_values(和:mongoize)) end end |
#可调整大小? ⇒ true
这个对象的大小可以改变吗?
139 140 141 |
# File 'lib/mongoid/extensions/hash.rb', line 139 def 可调整大小? true end |