模块:Mongoid::Extensions::Set::ClassMethods
- 定义于:
- lib/mongoid/extensions/ 设立.rb
实例方法摘要折叠
-
# demogoize (object) ⇒ 设置
将对象从其 mongo 友好的 Ruby 类型转换为此类型。
-
# mongoize (对象) ⇒ 数组 | nil
将对象从我们处理的Ruby类型转换为mongo友好类型。
实例方法详细信息
# demogoize (object) ⇒设置
将对象从其 mongo 友好的 Ruby 类型转换为此类型。
39 40 41 42 43 44 |
# File 'lib/mongoid/extensions/ 设立.rb', line 39 def demogoize(对象) 案例 对象 when ::集 then 对象 when ::阵列 then ::集.new(对象) end end |
# mongoize (对象) ⇒数组| nil
将对象从我们处理的Ruby类型转换为mongo友好类型。
55 56 57 58 59 60 61 |
# File 'lib/mongoid/extensions/ 设立.rb', line 55 def mongoize(对象) return if 对象.nil? 案例 对象 when ::集 then ::阵列.mongoize(对象.to_a).uniq when ::阵列 then ::阵列.mongoize(对象).uniq end end |