Class: Nexpose::Generate
- Inherits:
-
Object
- Object
- Nexpose::Generate
- Defined in:
- lib/nexpose/report.rb
Overview
Data object associated with when a report is generated.
Instance Attribute Summary collapse
-
#after_scan ⇒ Object
Will the report be generated after a scan completes (true), or is it ad-hoc/scheduled (false).
-
#schedule ⇒ Object
Schedule associated with the report.
-
#scheduled ⇒ Object
Whether or not a scan is scheduled.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(after_scan, scheduled, schedule = nil) ⇒ Generate
constructor
A new instance of Generate.
- #to_xml ⇒ Object
Constructor Details
#initialize(after_scan, scheduled, schedule = nil) ⇒ Generate
Returns a new instance of Generate.
434 435 436 437 438 |
# File 'lib/nexpose/report.rb', line 434 def initialize(after_scan, scheduled, schedule = nil) @after_scan = after_scan @scheduled = scheduled @schedule = schedule end |
Instance Attribute Details
#after_scan ⇒ Object
Will the report be generated after a scan completes (true), or is it ad-hoc/scheduled (false).
428 429 430 |
# File 'lib/nexpose/report.rb', line 428 def after_scan @after_scan end |
#schedule ⇒ Object
Schedule associated with the report.
432 433 434 |
# File 'lib/nexpose/report.rb', line 432 def schedule @schedule end |
#scheduled ⇒ Object
Whether or not a scan is scheduled.
430 431 432 |
# File 'lib/nexpose/report.rb', line 430 def scheduled @scheduled end |
Class Method Details
.parse(xml) ⇒ Object
446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
# File 'lib/nexpose/report.rb', line 446 def self.parse(xml) xml.elements.each('//Generate') do |generate| if generate.attributes['after-scan'] == '1' return Generate.new(true, false) else if generate.attributes['schedule'] == '1' schedule = Schedule.parse(xml) return Generate.new(false, true, schedule) end return Generate.new(false, false) end end nil end |
Instance Method Details
#to_xml ⇒ Object
440 441 442 443 444 |
# File 'lib/nexpose/report.rb', line 440 def to_xml xml = %Q{<Generate after-scan='#{@after_scan ? 1 : 0}' schedule='#{@scheduled ? 1 : 0}'>} xml << @schedule.to_xml if @schedule xml << '</Generate>' end |