module GSA::XMLizer

Public Instance Methods

attributor(attributes) click to toggle source

for creating attributes on tags

# 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={}) click to toggle source

for container tags

# 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={}) click to toggle source

for single-line tags

# File lib/gsa/modules/xmlizer.rb, line 10
def tag(tag, attributes={})
  "<#{tag.to_s}#{attributor(attributes)}/>\n"
end
xml(content) click to toggle source
# File lib/gsa/modules/xmlizer.rb, line 5
def xml(content)
  "#{GSA::XML_TYPE}\n#{GSA::DOC_TYPE}\n#{content}"
end