Class: Athena::Formats::XML::Flat
- Inherits:
-
Athena::Formats::XML
- Object
- Base
- Athena::Formats::XML
- Athena::Formats::XML::Flat
- Defined in:
- lib/athena/formats/xml.rb
Constant Summary
Constants inherited from Athena::Formats::XML
ELEMENT_START_RE, NON_ELEMENT_CHAR_RE, VALUE_SEPARATOR
Instance Attribute Summary
Attributes inherited from Athena::Formats::XML
Attributes inherited from Base
#config, #output, #record_element
Instance Method Summary collapse
Methods inherited from Athena::Formats::XML
Methods inherited from Base
#deferred?, directions, format, has_direction?, init, #init, #parse, #raw?, #run
Instance Method Details
#convert(record) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# 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 |