Class: Importer::Parser::Xml
Overview
XML parser Uses crack/xml lib to parse the XML files.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Importer::Parser::Base
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/importer/parser/xml.rb', line 8 def run @data = [] file = File.new(@file) data = Crack::XML.parse(file) root = data.shift[1] if root objects = root.shift[1] @data = objects.is_a?(Hash) ? [objects] : objects end @data end |