class Nexpose::Section

Section specific content to include in a report template.

Attributes

name[RW]

Name of the report section.

properties[RW]

Map of properties specific to the report section.

Public Class Methods

new(name) click to toggle source
# File lib/nexpose/report_template.rb, line 220
def initialize(name)
  @name       = name
  @properties = {}
end
parse(xml) click to toggle source
# File lib/nexpose/report_template.rb, line 235
def self.parse(xml)
  name = xml.attributes['name']
  xml.elements.each("//ReportSection[@name='#{name}']") do |elem|
    section = Section.new(name)
    elem.elements.each("//ReportSection[@name='#{name}']/property") do |property|
      section.properties[property.attributes['name']] = property.text
    end
    return section
  end
  nil
end

Public Instance Methods

to_xml() click to toggle source
# File lib/nexpose/report_template.rb, line 227
def to_xml
  xml = %(<ReportSection name='#{@name}'>)
  properties.each_pair do |name, value|
    xml << %(<property name='#{name}'>#{replace_entities(value)}</property>)
  end
  xml << '</ReportSection>'
end