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, line 77
def convert(record)
  super { |field, struct|
    strings = []

    struct[:elements].each { |element|
      values = (struct[:values][element] || []).map { |v|
        (v || '').strip
      }.reject { |v| v.empty? }

      strings << (values.empty? ? struct[:empty] : values.join(VALUE_SEPARATOR))
    }

    builder.tag!(field, struct[:string] % strings)
  }
end