Module: Chemicalml::Cml::Base::Dictionary

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

def self.included(klass)
  klass.class_eval do
    include Chemicalml::Cml::Role::Dictionary
    attribute :title, :string
    attribute :namespace, :string
    attribute :dictionary_prefix, :string
    attribute :convention, :string
    attribute :description, :string
    attribute :entries, :entry, collection: true

    xml do
    namespace Chemicalml::Cml::Namespace
      root "dictionary"
      map_attribute "title", to: :title
      map_attribute "namespace", to: :namespace
      map_attribute "dictionaryPrefix", to: :dictionary_prefix
      map_attribute "convention", to: :convention
      map_element "description", to: :description
      map_element "entry", to: :entries
    end
  end
end