Module: IPXACT::Parser::BusData
- Defined in:
- lib/ipxact/parser/bus_data_parser.rb
Overview
Module for parsing IPXACT bus XML data.
Class Method Summary collapse
-
.extract_bus_data(bus_doc, host_component, variables) ⇒ Array<Symbol, Object>
Extracts any relevant data from the bus_doc bus interface.
-
.parse_bus(bus_doc, host_component, variables) ⇒ Hash
Parses the bus_doc bus interface data.
Class Method Details
.extract_bus_data(bus_doc, host_component, variables) ⇒ Array<Symbol, Object>
Extracts any relevant data from the bus_doc bus interface.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ipxact/parser/bus_data_parser.rb', line 65 def self.extract_bus_data(bus_doc, host_component, variables) if bus_doc.xpath("./spirit:mirroredMaster").size > 0 [:mirrored_master, extract_mirrored_master_data] elsif bus_doc.xpath("./spirit:mirroredSlave").size > 0 [:mirrored_slave, extract_mirrored_slave_data(bus_doc, host_component, variables)] elsif bus_doc.xpath("./spirit:slave").size > 0 [:slave, extract_slave_data(bus_doc, host_component)] elsif bus_doc.xpath("./spirit:master").size > 0 [:master, extract_master_data(bus_doc, host_component)] end end |
.parse_bus(bus_doc, host_component, variables) ⇒ Hash
Parses the bus_doc bus interface data.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ipxact/parser/bus_data_parser.rb', line 40 def self.parse_bus(bus_doc, host_component, variables) port_type, port_data = extract_bus_data(bus_doc, host_component, variables) { :name => bus_doc.xpath("./spirit:name").first.text, :type => port_type, :bus_type => bus_doc.xpath("./spirit:busType").first['name'], :library => bus_doc.xpath("./spirit:busType").first['library'], :port_data => port_data } end |