Class: ADIWG::Mdtranslator::Writers::Simple_html::Html_Constraint

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

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Html_Constraint

Returns a new instance of Html_Constraint.



22
23
24
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb', line 22

def initialize(html)
   @html = html
end

Instance Method Details

#writeHtml(hConstraint) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb', line 26

def writeHtml(hConstraint)

   # classes used
   scopeClass = Html_Scope.new(@html)
   graphicClass = Html_Graphic.new(@html)
   citationClass = Html_Citation.new(@html)
   responsibilityClass = Html_Responsibility.new(@html)
   releasabilityClass = Html_Releasability.new(@html)
   legalClass = Html_LegalConstraint.new(@html)
   securityClass = Html_SecurityConstraint.new(@html)

   # constraint - type
   unless hConstraint[:type].nil?
      @html.em('Constraint Type: ')
      @html.text!(hConstraint[:type])
      @html.br
   end

   # constraint - use limitation []
   hConstraint[:useLimitation].each do |limitation|
      @html.em('Limitation: ')
      @html.div(:class => 'block') do
         @html.text!(limitation)
      end
   end

   # constraint - scope {scope}
   unless hConstraint[:scope].empty?
      @html.div do
         @html.div('Scope', {'class' => 'h5'})
         @html.div(:class => 'block') do
            scopeClass.writeHtml(hConstraint[:scope])
         end
      end
   end

   # constraint - graphic [] {graphic}
   hConstraint[:graphic].each do |hGraphic|
      @html.div do
         @html.div('Graphic', {'class' => 'h5'})
         @html.div(:class => 'block') do
            graphicClass.writeHtml(hGraphic)
         end
      end
   end

   # constraint - reference [] {citation}
   hConstraint[:reference].each do |hReference|
      @html.div do
         @html.div('Reference', {'class' => 'h5'})
         @html.div(:class => 'block') do
            citationClass.writeHtml(hReference)
         end
      end
   end

   # constraint - releasability {releasability}
   unless hConstraint[:releasability].empty?
      @html.div do
         @html.div('Releasability', {'class' => 'h5'})
         @html.div(:class => 'block') do
            releasabilityClass.writeHtml(hConstraint[:releasability])
         end
      end
   end

   # constraint - responsibility [] {responsibility}
   hConstraint[:responsibleParty].each do |hResponsibility|
      @html.div do
         @html.div(hResponsibility[:roleName], {'class' => 'h5'})
         @html.div(:class => 'block') do
            responsibilityClass.writeHtml(hResponsibility)
         end
      end
   end

   # constraint - legal {legal constraint}
   if hConstraint[:type] == 'legal' && !hConstraint[:legalConstraint].empty?
      legalClass.writeHtml(hConstraint[:legalConstraint])
   end

   # constraint - security {security constraint}
   if hConstraint[:type] == 'security' && !hConstraint[:securityConstraint].empty?
      securityClass.writeHtml(hConstraint[:securityConstraint])
   end

end