Class: AbstractXMLInstantiator
- Inherits:
-
Object
- Object
- AbstractXMLInstantiator
- Defined in:
- lib/rgen/instantiator/abstract_xml_instantiator.rb
Direct Known Subclasses
Defined Under Namespace
Classes: XMLScanVisitor
Instance Method Summary collapse
-
#instantiate(str, gcSuspendCount = 0) ⇒ Object
Parses str and calls start_tag, end_tag, set_attribute and text methods of a subclass.
- #text(str) ⇒ Object
Instance Method Details
#instantiate(str, gcSuspendCount = 0) ⇒ Object
Parses str and calls start_tag, end_tag, set_attribute and text methods of a subclass.
If gcSuspendCount is specified, the garbage collector will be disabled for that number of start or end tags. After that period it will clean up and then be disabled again. A value of about 1000 can significantly improve overall performance. The memory usage normally does not increase. Depending on the work done for every xml tag the value might have to be adjusted.
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rgen/instantiator/abstract_xml_instantiator.rb', line 80 def instantiate(str, gcSuspendCount=0) gcDisabledBefore = GC.disable gcSuspendCount = 0 if gcDisabledBefore begin visitor = XMLScanVisitor.new(self, gcSuspendCount) parser = XMLScan::XMLParserNS.new(visitor) parser.parse(str) ensure GC.enable unless gcDisabledBefore end end |
#text(str) ⇒ Object
92 93 |
# File 'lib/rgen/instantiator/abstract_xml_instantiator.rb', line 92 def text(str) end |