Method: Nmap::XML.open

Defined in:
lib/nmap/xml.rb

.open(path) {|xml| ... } ⇒ Object

Creates a new XML object from the file.

Parameters:

  • path (String)

    The path to the XML file.

Yields:

  • (xml)

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

Yield Parameters:

  • xml (XML)

    The newly created XML object.

Since:

  • 0.7.0



87
88
89
90
91
92
# File 'lib/nmap/xml.rb', line 87

def self.open(path,&block)
  path = File.expand_path(path)
  doc  = Nokogiri::XML(File.open(path))

  new(doc, path: path, &block)
end