Module: Ecoportal::API::Common::Content::DoubleModel::Attributable::Nesting::CascadedCallback::ClassMethods
- Defined in:
- lib/ecoportal/api/common/content/double_model/attributable/nesting/cascaded_callback.rb
Instance Method Summary collapse
- #_cascaded_attribute!(meth, doc_key = meth, inherited: false) ⇒ Object
- #_cascaded_attributes ⇒ Object
- #_cascaded_doc_keys ⇒ Object
- #_cascaded_methods ⇒ Object
Instance Method Details
#_cascaded_attribute!(meth, doc_key = meth, inherited: false) ⇒ Object
Note:
it also tracks doc_key as cascaded attribute on
child classes.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/cascaded_callback.rb', line 18 def _cascaded_attribute!(meth, doc_key = meth, inherited: false) meth = meth.to_sym doc_key = doc_key.to_s dont_override = _cascaded_attributes.key?(meth) && inherited return _cascaded_attributes[meth] if dont_override _cascaded_attributes[meth] = doc_key subclasses.each do |subclass| subclass._cascaded_attribute!(meth, doc_key, inherited: true) end end |
#_cascaded_attributes ⇒ Object
32 33 34 |
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/cascaded_callback.rb', line 32 def _cascaded_attributes @_cascaded_attributes ||={} end |
#_cascaded_doc_keys ⇒ Object
40 41 42 |
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/cascaded_callback.rb', line 40 def _cascaded_doc_keys _cascaded_attributes.values.uniq end |
#_cascaded_methods ⇒ Object
36 37 38 |
# File 'lib/ecoportal/api/common/content/double_model/attributable/nesting/cascaded_callback.rb', line 36 def _cascaded_methods _cascaded_attributes.keys end |