Module: IPXACT::Parser::PlatformData

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

Overview

Module for parsing IPXACT XML data and creating a platform object. Only this parser module should be used for working with IPXACT data.

Author:

  • Guillaume Godet-Bar

Class Method Summary collapse

Class Method Details

.parse_platform(platform_id, component_docs, design_docs, constraints = []) ⇒ Platform

Parses the component_docs and design_docs for creating a new IPXACT::Platform instance.

Parameters:

  • platform_id (String, Array<String>)

    the platform identifier, which should appear in one of the design_docs. This identifier can either be a String (in which circumstance the most recent component with the given name will be returned, if any) or an Array of 2 elements, composed as follows:

    [<platform_identifier>, <platform_version>]
    
  • component_docs (Hash<String, Nokogiri::Node>)

    the Hash of Nokogiri component documents that was extracted from the platform’s IPXACT specification.

  • design_docs (Hash<String, Nokogiri::Node>)

    the Hash of Nokogiri design documents that was extracted from the platform’s IPXACT specification.

  • constraints (Array<String>) (defaults to: [])

    the constraints imposed on components. A constraint is an Array of 2 elements, composed as follows:

    [<component_identifier>, <component_version>]
    

    For each component instanciated during the parsing of the platform, the parser will verify if any of the constraints may apply and then select the appropriate component.

Returns:

  • (Platform)

    the IPXACT::Platform instance. All the design documents related to the platform or any platform component are used for completing the IPXACT::Platform object. Additionally, all the variable elements, if any, are applied where appropriate.



57
58
59
60
61
62
# File 'lib/ipxact/parser/platform_data_parser.rb', line 57

def self.parse_platform(platform_id, component_docs, design_docs, constraints=[])
  base_component = IPXACT::Parser::ComponentData.parse_component(
                                     platform_id, "", {}, component_docs,
                                     design_docs, constraints)
  IPXACT::Platform.new(base_component)
end