Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

CSV::Row.new

new(headers, fields, header_row = false)

Constructs a new CSV::Row from headers and fields, which are expected to be Arrays. If one Array is shorter than the other, it will be padded with nil objects.

The optional header_row parameter can be set to true to indicate, via CSV::Row.header_row?() and CSV::Row.field_row?(), that this is a header row. Otherwise, the row assumes to be a field row.

A CSV::Row object supports the following Array methods through delegation:

  • empty?()

  • length()

  • size()

See also #<< #== also in 3.3 · 3.2 · 3.1