Method: CSV::Row#headers

Defined in:
lib/csv/row.rb

#headersObject

:call-seq:

row.headers -> array_of_headers

Returns the headers for this row:

source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n"
table = CSV.parse(source, headers: true)
row = table.first
row.headers # => ["Name", "Value"]


160
161
162
# File 'lib/csv/row.rb', line 160

def headers
  @row.map(&:first)
end