Method: CSV::Row#headers
- Defined in:
- lib/csv/row.rb
#headers ⇒ Object
:call-seq:
row.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"]
81 82 83 |
# File 'lib/csv/row.rb', line 81 def headers @row.map(&:first) end |