Class: ASpaceExport::RawXMLHandler
- Inherits:
- 
      Object
      
        - Object
- ASpaceExport::RawXMLHandler
 
- Defined in:
- backend/app/exporters/lib/streaming_xml.rb
Instance Method Summary collapse
- 
  
    
      #<<(s)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #initialize  ⇒ RawXMLHandler 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of RawXMLHandler. 
- 
  
    
      #substitute_fragments(xml_string)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Constructor Details
#initialize ⇒ RawXMLHandler
Returns a new instance of RawXMLHandler.
| 4 5 6 | # File 'backend/app/exporters/lib/streaming_xml.rb', line 4 def initialize @fragments = {} end | 
Instance Method Details
#<<(s) ⇒ Object
| 8 9 10 11 12 | # File 'backend/app/exporters/lib/streaming_xml.rb', line 8 def <<(s) id = SecureRandom.hex @fragments[id] = s ":aspace_fragment_#{id}" end | 
#substitute_fragments(xml_string) ⇒ Object
| 14 15 16 17 18 19 20 | # File 'backend/app/exporters/lib/streaming_xml.rb', line 14 def substitute_fragments(xml_string) @fragments.each do |id, fragment| xml_string.gsub!(/:aspace_fragment_#{id}/, fragment) end xml_string end |