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::Table.new

new(array_of_rows, headers: nil)

Constructs a new CSV::Table from array_of_rows, which are expected to be CSV::Row objects. All rows are assumed to have the same headers.

The optional headers parameter can be set to Array of headers. If headers aren’t set, headers are fetched from CSV::Row objects. Otherwise, headers() method will return headers being set in headers argument.

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

  • empty?()

  • length()

  • size()

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