class Athena::Formats::XML::Flat

Public Instance Methods

convert(record) click to toggle source
Calls superclass method Athena::Formats::XML#convert
   # File lib/athena/formats/xml.rb
77 def convert(record)
78   super { |field, struct|
79     strings = []
80 
81     struct[:elements].each { |element|
82       values = (struct[:values][element] || []).map { |v|
83         (v || '').strip
84       }.reject { |v| v.empty? }
85 
86       strings << (values.empty? ? struct[:empty] : values.join(VALUE_SEPARATOR))
87     }
88 
89     builder.tag!(field, struct[:string] % strings)
90   }
91 end