Module: Ecoportal::API::Common::Content::DoubleModel::DoubleDoc::RootedKey
- Extended by:
- Includer
- Defined in:
- lib/ecoportal/api/common/content/double_model/double_doc/rooted_key.rb
Instance Method Summary collapse
-
#_rooted_doc_key(value) ⇒ Object
Offers a method for child classes to transform the key, provided that the child's
doccan be accessed.
Methods included from Includer
Instance Method Details
#_rooted_doc_key(value) ⇒ Object
Note:
this method was introduced with CollectionModel. The individual
elements/items wouldn't know how to fetch their own model via their
parent. This required to introduce _rooted_doc_key in all DoubleModel
ancestors. It just delegates up the resolution of a value key.
Note:
this method can't be protected. It might be accessed by cousing classes. parent class to a child class. See last line of this method.
Offers a method for child classes to transform the key,
provided that the child's doc can be accessed.
33 34 35 36 37 38 39 40 |
# File 'lib/ecoportal/api/common/content/double_model/double_doc/rooted_key.rb', line 33 def _rooted_doc_key(value) #print "!(#{value}<=#{self.class})" if value.is_a?(Content::DoubleModel) && !value.root? return value unless value.is_a?(Content::DoubleModel) return value if value.root? #print "?(#{value.class}<=#{value._parent.class})" value._parent._rooted_doc_key(value) end |