模块:Mongoid::Attributes::Processing
- 包含在:
- Mongoid::Attributes
- 定义于:
- lib/mongoid/attributes/ 处理
Overview
该模块包含处理属性的行为。
实例方法摘要折叠
-
# process_attributes (attrs = nil) {|_self| ... } ⇒ 对象
如果文档中存在这些属性的字段,则处理提供的属性,将其转换为正确的值。
实例方法详细信息
# process_attributes (attrs = nil) {|_self| ... } ⇒对象
如果文档中存在这些属性的字段,则处理提供的属性,将其转换为正确的值。 这将仅限于所提供的Hash
中提供的属性,以便不会将额外的nil 值放入文档的属性中。
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mongoid/attributes/ 处理', line 16 def process_attributes(attrs = nil) attrs ||= {} 除非 attrs.空? attrs = sanitize_for_mass_signment(attrs) attrs.each_pair do |key, 值| 来年 if 待处理属性?(key, 值) process_attribute(key, 值) end end 产量 self if block_given? process_pending end |