class NipperParser::Information
Attributes
Information
parses the 'Information' part
@example Basic Usage
require 'nokogiri' require 'pp' config = Nokogiri::XML open(ARGV[0]) pp information.title pp information.author pp information.date pp information.version pp information.devices
@param config [Nokogiri::XML] parsed XML @attr_reader config [Nokogiri::XML] parsed XML object @attr_reader title [Sting] report title @attr_reader author [Sting] report author @attr_reader date [Sting] report generation date @attr_reader version [Sting] Nipper Studio version @attr_reader the tested devices
Information
parses the 'Information' part
@example Basic Usage
require 'nokogiri' require 'pp' config = Nokogiri::XML open(ARGV[0]) pp information.title pp information.author pp information.date pp information.version pp information.devices
@param config [Nokogiri::XML] parsed XML @attr_reader config [Nokogiri::XML] parsed XML object @attr_reader title [Sting] report title @attr_reader author [Sting] report author @attr_reader date [Sting] report generation date @attr_reader version [Sting] Nipper Studio version @attr_reader the tested devices
Information
parses the 'Information' part
@example Basic Usage
require 'nokogiri' require 'pp' config = Nokogiri::XML open(ARGV[0]) pp information.title pp information.author pp information.date pp information.version pp information.devices
@param config [Nokogiri::XML] parsed XML @attr_reader config [Nokogiri::XML] parsed XML object @attr_reader title [Sting] report title @attr_reader author [Sting] report author @attr_reader date [Sting] report generation date @attr_reader version [Sting] Nipper Studio version @attr_reader the tested devices
Information
parses the 'Information' part
@example Basic Usage
require 'nokogiri' require 'pp' config = Nokogiri::XML open(ARGV[0]) pp information.title pp information.author pp information.date pp information.version pp information.devices
@param config [Nokogiri::XML] parsed XML @attr_reader config [Nokogiri::XML] parsed XML object @attr_reader title [Sting] report title @attr_reader author [Sting] report author @attr_reader date [Sting] report generation date @attr_reader version [Sting] Nipper Studio version @attr_reader the tested devices
Information
parses the 'Information' part
@example Basic Usage
require 'nokogiri' require 'pp' config = Nokogiri::XML open(ARGV[0]) pp information.title pp information.author pp information.date pp information.version pp information.devices
@param config [Nokogiri::XML] parsed XML @attr_reader config [Nokogiri::XML] parsed XML object @attr_reader title [Sting] report title @attr_reader author [Sting] report author @attr_reader date [Sting] report generation date @attr_reader version [Sting] Nipper Studio version @attr_reader the tested devices
Public Class Methods
@config The configuration [File]
# File lib/nipper_parser/parsers/information.rb, line 27 def initialize(config) @config = config.xpath('//information')[0] @title = @config.elements[0].text @author = @config.elements[1].text @date = @config.elements[2].text @version = @config.elements[3].elements[3].text @devices = parse_devices end
Public Instance Methods
parse_devices
parse first devices list of the report @return [Array<Hash{Symbol => String}>]
# File lib/nipper_parser/parsers/information.rb, line 38 def parse_devices @config.xpath('devices')[0].elements.map do |device| { name: device.attributes['name'].text, type: device.attributes['type'].text, os: device.attributes['os'].text } end end