Class: Csvtool::Infrastructure::CSV::HeaderReader
- Inherits:
-
Object
- Object
- Csvtool::Infrastructure::CSV::HeaderReader
- Defined in:
- lib/csvtool/infrastructure/csv/header_reader.rb
Instance Method Summary collapse
Instance Method Details
#call(file_path:, col_sep:) ⇒ Object
9 10 11 12 13 |
# File 'lib/csvtool/infrastructure/csv/header_reader.rb', line 9 def call(file_path:, col_sep:) first_row = ::CSV.open(file_path, "r", headers: true, col_sep: col_sep, &:first) headers = first_row&.headers || [] headers.compact.reject(&:empty?) end |