Class: Nexpose::Frequency
- Inherits:
-
Object
- Object
- Nexpose::Frequency
- 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) ⇒ Frequency
constructor
A new instance of Frequency.
- #to_xml ⇒ Object
Constructor Details
#initialize(after_scan, scheduled, schedule = nil) ⇒ Frequency
Returns a new instance of Frequency.
473 474 475 476 477 |
# File 'lib/nexpose/report.rb', line 473 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).
467 468 469 |
# File 'lib/nexpose/report.rb', line 467 def after_scan @after_scan end |
#schedule ⇒ Object
Schedule associated with the report.
471 472 473 |
# File 'lib/nexpose/report.rb', line 471 def schedule @schedule end |
#scheduled ⇒ Object
Whether or not a scan is scheduled.
469 470 471 |
# File 'lib/nexpose/report.rb', line 469 def scheduled @scheduled end |
Class Method Details
.parse(xml) ⇒ Object
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/nexpose/report.rb', line 485 def self.parse(xml) xml.elements.each('//Generate') do |generate| if generate.attributes['after-scan'] == '1' return Frequency.new(true, false) else if generate.attributes['schedule'] == '1' generate.elements.each('Schedule') do |sched| schedule = Schedule.parse(sched) return Frequency.new(false, true, schedule) end end return Frequency.new(false, false) end end nil end |
Instance Method Details
#to_xml ⇒ Object
479 480 481 482 483 |
# File 'lib/nexpose/report.rb', line 479 def to_xml xml = %(<Generate after-scan="#{@after_scan ? 1 : 0}" schedule="#{@scheduled ? 1 : 0}">) xml << @schedule.to_xml if @schedule xml << '</Generate>' end |