Method: Nmap::XML#initialize

Defined in:
lib/nmap/xml.rb

#initialize(doc, path: nil) {|xml| ... } ⇒ XML

Creates a new XML object.

Parameters:

  • doc (Nokogiri::XML::Document)

    The path to the Nmap XML scan file or Nokogiri::XML::Document.

  • path (String, nil) (defaults to: nil)

    The optional path the XML was loaded from.

Yields:

  • (xml)

    If a block is given, it will be passed the new XML object.

Yield Parameters:

  • xml (XML)

    The newly created XML object.



48
49
50
51
52
53
# File 'lib/nmap/xml.rb', line 48

def initialize(doc, path: nil)
  @doc  = doc
  @path = File.expand_path(path) if path

  yield self if block_given?
end