#here's the grammar in BNF
#dyn ::= <columns>
#columns ::= <columns> '+' <column> | <column>
#column ::= <numeral> ':' <range> | <numeral>
#range ::= <numeral> <range_op> <numeral> | <numeral>
#range_op ::= '..' | ','
#numeral ::= the set of integer numbers
def translate_composite(row, spec)
result = ''
columns = spec.split('+')
columns.each do |unparsed_column|
col_and_range = unparsed_column.split(':')
column = col_and_range[0].to_i
result << if col_and_range.length > 1
slicer(row[column].strip, col_and_range[1])
else
row[column].to_s
end
end
result.blank? ? nil : result
end