Class: LWAC::MultiXMLFormatter
- Defined in:
- lib/lwac/export/format.rb
Overview
Output to an erb template
Instance Method Summary collapse
Methods inherited from Formatter
#<<, #add_data, #close_output, #initialize, #open_output, #open_point, #write_header
Constructor Details
This class inherits a constructor from LWAC::Formatter
Instance Method Details
#close_point ⇒ Object
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/lwac/export/format.rb', line 240 def close_point() filename = get_filename( @data ) $log.debug "Writing point to file #{filename}..." $log.warn "Overwriting (#{filename}) (you might have selected a non-unique key field)" if File.exist?(filename) File.open(filename, 'w'){ |f| xml = build_xml_doc( @data, nil, "data") # Select a formatter formatter = case(@config[:xml_format]) when :whitespace REXML::Formatters::Transitive.new(@config[:xml_indent] || 2) when :pretty REXML::Formatters::Pretty.new(@config[:xml_indent] || 2) else REXML::Formatters::Default.new() end # Compact if pretty formatter.compact = true if @config[:xml_format] == :pretty # Do output formatter.write( xml, f ) } end |