Class: Warpaint::NetXML
Instance Method Summary collapse
Methods inherited from Parser
Constructor Details
This class inherits a constructor from Warpaint::Parser
Instance Method Details
#parse_into(struct) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/warpaint/netxml.rb', line 7 def parse_into(struct) File.open(@input_file) do |f| doc = Nokogiri::XML(f) doc.xpath("//wireless-network[@type='infrastructure'][SSID]").each do |net| last_time = net.attribute("last-time").value encryption = net.xpath("SSID/encryption").children.to_s ssid = net.xpath("SSID/essid[@cloaked='false']") if !ssid.empty? essid = ssid.children.to_s struct.add_wireless_network(:last_time => Time.parse(last_time), :essid => essid, :encryption => encryption) end end end end |