Module: IPXACT::Parser::IdentifierData

Defined in:
lib/ipxact/parser/identifier_parser.rb

Overview

Module for parsing IPXACT identifiers into a ruby Identifier

Author:

  • Guillaume Godet-Bar

Class Method Summary collapse

Class Method Details

.parse_identifier(ipxact_root) ⇒ IPXACT::Identifier

Parses the XML node (assuming it has the required children) into an Identifier

Parameters:

  • ipxact_root (Nokogiri::Node)

    The XML node that should be parsed.

Returns:



31
32
33
34
35
36
37
38
39
# File 'lib/ipxact/parser/identifier_parser.rb', line 31

def self.parse_identifier(ipxact_root)
  args = {
    :name => ipxact_root.xpath('./spirit:name').first.text,
    :vendor => ipxact_root.xpath('./spirit:vendor').first.text,
    :library => ipxact_root.xpath('./spirit:library').first.text,
    :version => ipxact_root.xpath('./spirit:version').first.text
  }
  IPXACT::Identifier.new(args)
end

.parse_reference(ipxact_root) ⇒ IPXACT::Identifier

Parses the XML node (assuming it has the required attributes) into an Identifier

Parameters:

  • ipxact_root (Nokogiri::Node)

    The XML node that should be parsed.

Returns:



49
50
51
52
53
54
55
56
57
# File 'lib/ipxact/parser/identifier_parser.rb', line 49

def self.parse_reference(ipxact_root)
  args = {
    :name => ipxact_root['name'],
    :vendor => ipxact_root['vendor'],
    :library => ipxact_root['library'],
    :version => ipxact_root['version']
  }
  IPXACT::Identifier.new(args)
end