End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
CSV#line
csv.line → array
lib/csv.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/csv.rb, line 2037
def line
parser.line
end
Returns the line most recently read:
Example
string = "foo,0\nbar,1\nbaz,2\n" path = 't.csv' File.write(path, string) CSV.open(path) do |csv| csv.each do |row| p [csv.lineno, csv.line] end end
Output:
Example
[1, "foo,0\n"] [2, "bar,1\n"] [3, "baz,2\n"]