Skip to content

Commit

Permalink
Change parse_quote_character_nil to private
Browse files Browse the repository at this point in the history
  • Loading branch information
284km committed Mar 12, 2019
1 parent 19b7508 commit 4d38659
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions lib/csv/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,33 +227,6 @@ def line
last_line
end

def parse_quote_character_nil(&block)
while true
return nil unless value = @input.gets(@row_separator)
next if @skip_lines and skip_line?(value)

value.chomp!

row = []
if value.empty?
next if @skip_blanks
else
columns = if @column_separator == " "
value.split(@column_end, -1)
else
value.split(@column_separator, -1)
end
columns.each do |column|
row << (column.empty? ? nil : column)
end
end
@last_line = value

emit_row(row, &block)
end
@parsed = true
end

def parse(&block)
return to_enum(__method__) unless block_given?

Expand Down Expand Up @@ -779,6 +752,31 @@ def parse_row_end
end
end

def parse_quote_character_nil(&block)
while true
return nil unless value = @input.gets(@row_separator)
next if @skip_lines and skip_line?(value)
value.chomp!

row = []
if value.empty?
next if @skip_blanks
else
columns = if @column_separator == " "
value.split(@column_end, -1)
else
value.split(@column_separator, -1)
end
columns.each do |column|
row << (column.empty? ? nil : column)
end
end
@last_line = value
emit_row(row, &block)
end
@parsed = true
end

def start_row
if @last_line
@last_line = nil
Expand Down

0 comments on commit 4d38659

Please sign in to comment.