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
# File 'lib/chemicalml/cml/base/unit_type.rb', line 7

def self.included(klass)
  klass.class_eval do
    include Chemicalml::Cml::Role::UnitType
    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
  end
end