模块:Mongoid::Extensions::Range::ClassMethods
- 定义于:
- lib/mongoid/extensions/ 范围.rb
实例方法摘要折叠
-
# demogoize (object) ⇒ 范围 | nil
将对象从其 mongo 友好的 Ruby 类型转换为此类型。
-
# mongoize (对象) ⇒ 哈希 | nil
将对象从我们处理的Ruby类型转换为mongo友好类型。
实例方法详细信息
# demogoize (对象) ⇒范围| nil
将对象从其 mongo 友好的 Ruby 类型转换为此类型。
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/mongoid/extensions/ 范围.rb', line 54 def demogoize(对象) return if 对象.nil? if 对象.is_a?(哈希) 哈希 = 对象.slice('min', 'max', ' exclude_end ', :min, :max, :exclude_end) 除非 哈希.空白? 开始 ::范围.new(哈希["min"] || 哈希[:min], 哈希[" max "] || 哈希[:max], 哈希[" exclusive_end "] || 哈希[:exclude_end]) 救援 ArgumentError nil end end end end |