Module: Chemicalml::Cml::Base::CommonChildren
- Defined in:
- lib/chemicalml/cml/base/common_children.rb
Overview
Universal CML child elements. The XSD grants metadataList, label, name, and description as children to most CML elements. Mixing this module into a Base::* module adds the four child declarations in one place — keeping DRY discipline.
Opt-in: only Base modules whose XSD declares these children include this mixin. This respects MECE ownership — each child declaration lives in exactly one place (here, for the universal set; in the specific Base module for element-specific children).
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/chemicalml/cml/base/common_children.rb', line 17 def self.included(klass) klass.class_eval do attribute :metadata_lists, :metadataList, collection: true attribute :labels, :label, collection: true attribute :names, :name, collection: true attribute :descriptions, :description, collection: true xml do map_element 'metadataList', to: :metadata_lists map_element 'label', to: :labels map_element 'name', to: :names map_element 'description', to: :descriptions end end end |