Class: Fabulator::Compiler
- Inherits:
-
Object
- Object
- Fabulator::Compiler
- Defined in:
- lib/fabulator/compiler.rb
Instance Method Summary collapse
-
#compile(xml) ⇒ Object
Calls the right compiler object based on the root element.
-
#initialize ⇒ Compiler
constructor
A new instance of Compiler.
Constructor Details
Instance Method Details
#compile(xml) ⇒ Object
Calls the right compiler object based on the root element
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fabulator/compiler.rb', line 10 def compile(xml) XML.default_line_numbers = true doc = nil if xml.is_a?(String) doc = LibXML::XML::Document.string xml doc = doc.root elsif xml.is_a?(LibXML::XML::Document) doc = xml.root else doc = xml end @context.compile_structural(doc) end |