Module: Chemicalml::Cml::Base::Link

Included in:
Schema24::Link, Schema3::Link
Defined in:
lib/chemicalml/cml/base/link.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/chemicalml/cml/base/link.rb', line 7

def self.included(klass)
  klass.class_eval do
    include Chemicalml::Cml::Role::Link

    attribute :id, :string
    attribute :title, :string
    attribute :dict_ref, :string
    attribute :convention, :string
    attribute :href, :string
    attribute :rel, :string
    attribute :title, :string
    attribute :type, :string
    attribute :role, :string

    attribute :from, :string
    attribute :to, :string
    attribute :ref, :string
    attribute :from_type, :string
    attribute :to_type, :string
    attribute :from_set, :string
    attribute :to_set, :string
    attribute :from_context, :string
    attribute :to_context, :string
    attribute :link_type, :string
    xml do
      namespace Chemicalml::Cml::Namespace
      root 'link'
      map_attribute 'id', to: :id
      map_attribute 'title', to: :title
      map_attribute 'dictRef', to: :dict_ref
      map_attribute 'convention', to: :convention
      map_attribute 'href', to: :href
      map_attribute 'rel', to: :rel
      map_attribute 'title', to: :title
      map_attribute 'type', to: :type
      map_attribute 'role', to: :role
      map_attribute 'from', to: :from
      map_attribute 'to', to: :to
      map_attribute 'ref', to: :ref
      map_attribute 'fromType', to: :from_type
      map_attribute 'toType', to: :to_type
      map_attribute 'fromSet', to: :from_set
      map_attribute 'toSet', to: :to_set
      map_attribute 'fromContext', to: :from_context
      map_attribute 'toContext', to: :to_context
      map_attribute 'linkType', to: :link_type
    end
    key_value do
      map 'id', to: :id
      map 'title', to: :title
      map 'dictRef', to: :dict_ref
      map 'convention', to: :convention
      map 'href', to: :href
      map 'rel', to: :rel
      map 'type', to: :type
      map 'role', to: :role
      map 'from', to: :from
      map 'to', to: :to
      map 'ref', to: :ref
      map 'fromType', to: :from_type
      map 'toType', to: :to_type
      map 'fromSet', to: :from_set
      map 'toSet', to: :to_set
      map 'fromContext', to: :from_context
      map 'toContext', to: :to_context
      map 'linkType', to: :link_type
    end
  end
end