模块:Mongoid::Attributes::Embedded
Overview
用于处理嵌入式属性的实用程序模块。
实例方法摘要折叠
-
# traverse (attributes, path) ⇒ 对象 | nil
通过点表示法获取嵌入值或属性子集。
实例方法详细信息
# traverse (attributes, path) ⇒对象 | nil
通过点表示法获取嵌入值或属性子集。
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mongoid/attributes/embedded.rb', line 20 def 遍历(属性, 路径) 路径.拆分(' 。 ').每 do |key| 中断 if 属性.nil? 属性 = if 属性.try(:key?, key) 属性[key] elsif 属性.respond_to?(:each) && key.匹配?(/\A\d+\z/) 属性[key.to_i] end end 属性 end |