lib/sycsvpro/header.rb
def process(line, values = true)
      return "" if @header_cols.empty? && @insert_cols.empty?
      header_patterns = {}
      @row_cols = unstring(line).split(';')
      if @header_cols[0] == '*'
        @header_cols[0] = @row_cols
      else
        @header_cols.each_with_index do |h,i|
          if h =~ /^\(?c\d+(?:[=~]{,2}).*$/ 
            if col = eval(h)
              last_eval = $1
              unless @header_cols.index(last_eval) || @header_cols.index(col)
                if values
                  @header_cols[i] = (h =~ /^\(?c\d+=~/) ? last_eval : col
                  header_patterns[i+1] = h if h =~ /^\(?c\d+[=~+-.]{1,2}/
                else
                  @header_cols[i] = col if h =~ /^\(?c\d+$/
                end
              end
            end
          else
            @header_cols[i] = h
          end
        end
      end
      insert_header_cols
      header_patterns.each { |i,h| @header_cols.insert(i,h) }
      to_s
    end
def process(line, values = true)
      return "" if @header_cols.empty? && @insert_cols.empty?
      header_patterns = {}
      @row_cols = unstring(line).split(';')
      if @header_cols[0] == '*'
        @header_cols[0] = @row_cols
      else
        @header_cols.each_with_index do |h,i|
          if h =~ /^\(?c\d+(?:[=~]{,2}).*$/ 
            if col = eval(h)
              last_eval = $1
              unless @header_cols.index(last_eval) || @header_cols.index(col)
                if values
                  @header_cols[i] = (h =~ /^\(?c\d+=~/) ? last_eval : col
                  header_patterns[i+1] = h if h =~ /^\(?c\d+[=~+-.]{1,2}/
                else
                  @header_cols[i] = col if h =~ /^\(?c\d+$/
                end
              end
            end
          else
            @header_cols[i] = h
          end
        end
      end
      insert_header_cols
      header_patterns.each { |i,h| @header_cols.insert(i,h) }
      to_s
    end
def process ( line , values = true ) return "" if @header_cols . empty? && @insert_cols . empty? header_patterns = { } @row_cols = unstring ( line ) . split ( ';' ) if @header_cols [ 0 ] == '*' @header_cols [ 0 ] = @row_cols else @header_cols . each_with_index do | h , i | if h =~ / \( \d / if col = eval ( h ) last_eval = $1 unless @header_cols . index ( last_eval ) || @header_cols . index ( col ) if values @header_cols [ i ] = ( h =~ / \( \d / ) ? last_eval : col header_patterns [ i + 1 ] = h if h =~ / \( \d / else @header_cols [ i ] = col if h =~ / \( \d / end end end else @header_cols [ i ] = h end end end insert_header_cols header_patterns . each { | i , h | @header_cols . insert ( i , h ) } to_s end
Returns the header
Returns the header