模块:Mongoid::Extensions::Regexp::ClassMethods
- 定义于:
- lib/mongoid/extensions/regexp.rb
实例方法摘要折叠
-
# mongoize (object) ⇒ Regexp | nil (又作:#demongoize)
将对象从我们处理的Ruby类型转换为mongo友好类型。
实例方法详细信息
# mongoize (object) ⇒ Regexp | nil也称为: demogoize
将对象从我们处理的Ruby类型转换为mongo友好类型。
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mongoid/extensions/regexp.rb', line 21 def mongoize(对象) return if 对象.nil? 案例 对象 when 字符串 then ::regexp.new(对象) when ::regexp then 对象 when BSON::regexp::原始 then 对象.编译 end 救援 RegexpError nil end |