Sha256: 7cb848074ccc2607a6cad2559b0cefd02978ecaa7eadf7fb0f644f8184c1e05e

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module LibEagle
  class ElementClassNotFound < StandardError; end
  class Parser

    def self.initElementClass(name,xml)
      class_name = LibEagle::CLASS_NAMES[name]
      if class_name
        LibEagle::const_get(class_name).new_with_xml(xml)
      else
        raise ElementClassNotFound.new("Element: `#{name}` class wasn't found in the list of the known classes")
      end
    end

  	def self.parseFile(file)
  		content = IO.read(file)
  		parseXML(content)
  	end

    def self.parseXML(xml_content)
      xml = Nokogiri::XML(xml_content)
      root = xml.root
      eagle = initElementClass(root.name, root)
      return eagle
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libeagle-1.1 lib/libeagle/libeagle.rb