Module: GSA::XMLizer

Includes:
Injector
Included in:
RecordsConverter
Defined in:
lib/gsa/modules/xmlizer.rb

Instance Method Summary collapse

Methods included from Injector

#inject, #inject_a, #inject_s

Instance Method Details

#attributor(attributes) ⇒ Object

for creating attributes on tags



20
21
22
# File 'lib/gsa/modules/xmlizer.rb', line 20

def attributor(attributes)
  inject_s(attributes) {|key, value| " #{key.to_s}=\"#{value.to_s}\""}
end

#block(tag, value, attributes = {}) ⇒ Object

for container tags



15
16
17
# File 'lib/gsa/modules/xmlizer.rb', line 15

def block(tag, value, attributes={})
  "<#{tag.to_s}#{attributor(attributes)}>\n" << value.to_s << "</#{tag.to_s}>\n"
end

#tag(tag, attributes = {}) ⇒ Object

for single-line tags



10
11
12
# File 'lib/gsa/modules/xmlizer.rb', line 10

def tag(tag, attributes={})
  "<#{tag.to_s}#{attributor(attributes)}/>\n"
end

#xml(content) ⇒ Object



5
6
7
# File 'lib/gsa/modules/xmlizer.rb', line 5

def xml(content)
  "#{GSA::XML_TYPE}\n#{GSA::DOC_TYPE}\n#{content}"
end