====== Option +headers+ Specifies a boolean, \Symbol, \Array, or \String to be used to define column headers. Default value: CSV::DEFAULT_OPTIONS.fetch(:headers) # => false --- Without +headers+: str = <<-EOT Name,Count foo,0 bar,1 bax,2 EOT csv = CSV.new(str) csv # => # csv.headers # => nil csv.shift # => ["Name", "Count"] --- If set to +true+ or the \Symbol +:first_row+, the first row of the data is treated as a row of headers: str = <<-EOT Name,Count foo,0 bar,1 bax,2 EOT csv = CSV.new(str, headers: true) csv # => # csv.headers # => ["Name", "Count"] csv.shift # => # --- If set to an \Array, the \Array elements are treated as headers: str = <<-EOT foo,0 bar,1 bax,2 EOT csv = CSV.new(str, headers: ['Name', 'Count']) csv csv.headers # => ["Name", "Count"] csv.shift # => # --- If set to a \String +str+, method CSV::parse_line(str, options) is called with the current +options+, and the returned \Array is treated as headers: str = <<-EOT foo,0 bar,1 bax,2 EOT csv = CSV.new(str, headers: 'Name,Count') csv csv.headers # => ["Name", "Count"] csv.shift # => #