title: ruby-nmap how to create hash output instead of xml
body: <p>I want to use the <a href="https://github.com/sophsec/ruby-nmap" rel="nofollow">ruby-nmap</a> gem to do a port scan on a number of instances. Here's what I'm currently using:</p>
  
  <pre><code>  Nmap::Program.scan do |nmap|
  
      nmap.syn_scan = true
      nmap.service_scan = true
      nmap.os_fingerprint = true
      nmap.xml = 'scan.xml'
      nmap.verbose = true
  
      # address[:public_ip] is my target
      nmap.targets = address[:public_ip]
    end
  </code></pre>
  
  <p>It creates an xml file, however I would prefer it gives me json or a hash as output and does not write this to a file.  Is there any easy way to do this without just reading the xml file it creates?</p>