Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Domain

Returns a new instance of Html_Domain.



20
21
22
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb', line 20

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(aDomains) ⇒ Object



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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb', line 24

def writeHtml(aDomains)

   # classes used
   itemClass = Html_DomainItem.new(@html)
   citationClass = Html_Citation.new(@html)

   aDomains.each do |hDomain|

      dName = 'domain'
      dName = hDomain[:domainCode] unless hDomain[:domainCode].nil?
      dName = hDomain[:domainName] unless hDomain[:domainName].nil?

      type = 'UNREPRESENTABLE'
      type = 'CODESET' unless hDomain[:domainReference].empty?
      type = 'ENUMERATED' unless hDomain[:domainItems].empty?

      @html.div do
         @html.div(dName, {'class' => 'h5'})
         @html.div(:class => 'block') do

            # domain - type
            @html.em('Domain Type: ')
            @html.text!(type)
            @html.br

            # domain - id
            unless hDomain[:domainId].nil?
               @html.em('ID: ')
               @html.text!(hDomain[:domainId])
               @html.br
            end

            # domain - name
            unless hDomain[:domainName].nil?
               @html.em('Name: ')
               @html.text!(hDomain[:domainName])
               @html.br
            end

            # domain - code
            unless hDomain[:domainCode].nil?
               @html.em('Code: ')
               @html.text!(hDomain[:domainCode])
               @html.br
            end

            # domain - description
            unless hDomain[:domainDescription].nil?
               @html.em('Description: ')
               @html.div(:class => 'block') do
                  @html.text!(hDomain[:domainDescription])
               end
            end

            # domain - domain reference {citation}
            unless hDomain[:domainReference].empty?
               @html.div do
                  @html.div('Reference', {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     citationClass.writeHtml(hDomain[:domainReference])
                  end
               end
            end

            # domain - domain items [] {domainItem}
            hDomain[:domainItems].each do |hItem|
               @html.div do
                  @html.div(hItem[:itemValue], {'class' => 'h5'})
                  @html.div(:class => 'block') do
                     itemClass.writeHtml(hItem)
                  end
               end
            end

         end
      end

   end # aDomain
end