Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_EntityAttribute

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_EntityAttribute



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

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hAttribute) ⇒ Object



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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_entityAttribute.rb', line 23

def writeHtml(hAttribute)

   # classes used
   periodClass = Html_TimePeriod.new(@html)
   citationClass = Html_Citation.new(@html)

   # entity attribute - common name
   unless hAttribute[:attributeName].nil?
      @html.em('Name: ')
      @html.text!(hAttribute[:attributeName])
      @html.br
   end

   # entity attribute - code name
   unless hAttribute[:attributeCode].nil?
      @html.em('Code: ')
      @html.text!(hAttribute[:attributeCode])
      @html.br
   end

   # entity attribute - aliases
   hAttribute[:attributeAlias].each do |otherName|
      @html.em('Alias: ')
      @html.text!(otherName)
      @html.br
   end

   # entity attribute - definition
   unless hAttribute[:attributeDefinition].nil?
      @html.em('Definition: ')
      @html.div(:class => 'block') do
         @html.text!(hAttribute[:attributeDefinition])
      end
   end

   # entity attribute - datatype
   unless hAttribute[:dataType].nil?
      @html.em('Datatype: ')
      @html.text!(hAttribute[:dataType])
      @html.br
   end

   # entity attribute - allow nulls {Boolean}
   @html.em('Allow NULL Values: ')
   @html.text!(hAttribute[:allowNull].to_s)
   @html.br

   # entity attribute - must be unique {Boolean}
   @html.em('Attribute Values Must Be Unique: ')
   @html.text!(hAttribute[:mustBeUnique].to_s)
   @html.br

   # entity attribute - unit of measure
   unless hAttribute[:unitOfMeasure].nil?
      @html.em('Unit of Measure: ')
      @html.text!(hAttribute[:unitOfMeasure])
      @html.br
   end

   # entity attribute - measure resolution {real}
   unless hAttribute[:measureResolution].nil?
      @html.em('Unit of Measure Resolution: ')
      @html.text!(hAttribute[:measureResolution].to_s)
      @html.br
   end

   # entity attribute - case sensitive {Boolean}
   @html.em('Value is Case Sensitive: ')
   @html.text!(hAttribute[:isCaseSensitive].to_s)
   @html.br

   # entity attribute - field width {integer}
   unless hAttribute[:fieldWidth].nil?
      @html.em('Field Width: ')
      @html.text!(hAttribute[:fieldWidth].to_s)
      @html.br
   end

   # entity attribute - missing value
   unless hAttribute[:missingValue].nil?
      @html.em('Missing Value: ')
      @html.text!(hAttribute[:missingValue])
      @html.br
   end

   # entity attribute - domain ID
   unless hAttribute[:domainId].nil?
      @html.em('Domain ID: ')
      @html.text!(hAttribute[:domainId])
      @html.br
   end

   # entity attribute - minimum value
   unless hAttribute[:minValue].nil?
      @html.em('Minimum Value: ')
      @html.text!(hAttribute[:minValue].to_s)
      @html.br
   end

   # entity attribute - code name
   unless hAttribute[:maxValue].nil?
      @html.em('Maximum Value: ')
      @html.text!(hAttribute[:maxValue].to_s)
      @html.br
   end

   # entity attribute - range of values [] {citation}
   hAttribute[:valueRange].each do |hRange|
      @html.div do
         @html.div('Range of Values', {'class' => 'h5'})
         @html.div(:class => 'block') do

            # range of values - minimum value
            unless hRange[:minRangeValue].nil?
               @html.em('Range Minimum: ')
               @html.text!(hRange[:minRangeValue].to_s)
               @html.br
            end

            # range of values - maximum value
            unless hRange[:maxRangeValue].nil?
               @html.em('Range Maximum: ')
               @html.text!(hRange[:maxRangeValue].to_s)
               @html.br
            end

         end
      end
   end

   # entity attribute - time period of values {timePeriod}
   hAttribute[:timePeriod].each do |hPeriod|
      @html.div do
         @html.div('Time Period of Values', {'class' => 'h5'})
         @html.div(:class => 'block') do
            periodClass.writeHtml(hPeriod)
         end
      end
   end

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

end