diff --git a/ChangeLog b/ChangeLog index 06b002c..aadb645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 5 13:49:20 2014 Thiago Lewin + + * lib/pathname.rb (CSV::Table#headers): search for the first + row with header. + [ruby-core:61154] + Wed Mar 5 11:58:30 2014 Nobuyoshi Nakada * ext/openssl/ossl.c (ossl_make_error): check NULL for unknown diff --git a/lib/csv.rb b/lib/csv.rb index e5ecf5c..e017b6f 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -676,7 +676,12 @@ class CSV if @table.empty? Array.new else - @table.first.headers + # search for the first row with headers + @table.each do |row| + row_headers = row.headers + return row_headers unless row_headers.empty? + end + Array.new end end