Module: Chemicalml::Cml::Base::UnitType

Included in:
Schema24::UnitType, Schema3::UnitType
Defined in:
lib/chemicalml/cml/base/unit_type.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chemicalml/cml/base/unit_type.rb', line 7

def self.included(klass)
  klass.class_eval do
    include Chemicalml::Cml::Role::UnitType
    include Chemicalml::Cml::Base::CommonChildren

    attribute :id, :string
    attribute :name, :string
    attribute :definition, :string
    attribute :description, :string

    attribute :title, :string
    attribute :parent_s_i, :string
    attribute :abbreviation, :string
    attribute :preserve, :string
    attribute :symbol, :string
    xml do
      namespace Chemicalml::Cml::Namespace
      root 'unitType'
      map_attribute 'id', to: :id
      map_attribute 'name', to: :name
      map_element 'definition', to: :definition
      map_element 'description', to: :description
      map_attribute 'title', to: :title
      map_attribute 'parentSI', to: :parent_s_i
      map_attribute 'abbreviation', to: :abbreviation
      map_attribute 'preserve', to: :preserve
      map_attribute 'symbol', to: :symbol
    end
    key_value do
      map 'metadataList', to: :metadata_lists
      map 'label', to: :labels
      map 'name', to: :names
      map 'description', to: :descriptions
      map 'definition', to: :definition
      map 'description', to: :description
      map 'id', to: :id
      map 'name', to: :name
      map 'title', to: :title
      map 'parentSI', to: :parent_s_i
      map 'abbreviation', to: :abbreviation
      map 'preserve', to: :preserve
      map 'symbol', to: :symbol
    end
  end
end