Flowdock
method

parse_quotable_loose

Importance_0
v2_6_3 - Show latest stable - 0 notes - Class: Parser
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
parse_quotable_loose(&block) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/csv/parser.rb, line 777
    def parse_quotable_loose(&block)
      @scanner.keep_start
      @scanner.each_line(@row_separator) do |line|
        if @skip_lines and skip_line?(line)
          @scanner.keep_drop
          @scanner.keep_start
          next
        end
        original_line = line
        line = line.delete_suffix(@row_separator)

        if line.empty?
          if @skip_blanks
            @scanner.keep_drop
            @scanner.keep_start
            next
          end
          row = []
        elsif line.include?(@cr) or line.include?(@lf)
          @scanner.keep_back
          @need_robust_parsing = true
          return parse_quotable_robust(&block)
        else
          row = line.split(@split_column_separator, -1)
          n_columns = row.size
          i = 0
          while i < n_columns
            column = row[i]
            if column.empty?
              row[i] = nil
            else
              n_quotes = column.count(@quote_character)
              if n_quotes.zero?
                # no quote
              elsif n_quotes == 2 and
                   column.start_with?(@quote_character) and
                   column.end_with?(@quote_character)
                row[i] = column[1..-2]
              else
                @scanner.keep_back
                @need_robust_parsing = true
                return parse_quotable_robust(&block)
              end
            end
            i += 1
          end
        end
        @scanner.keep_drop
        @scanner.keep_start
        @last_line = original_line
        emit_row(row, &block)
      end
      @scanner.keep_drop
    end
Register or log in to add new notes.