- unused keys in
key_mapping
now generate a warning, no longer raise an exception This is preferable whenkey_mapping
is done defensively for variabilities in the CSV files.
- completely rewrote line parser
- added methods
SmarterCSV.raw_headers
andSmarterCSV.headers
to allow easy examination of how the headers are processed.
- added missing keys to the SmarterCSV::KeyMappingError exception message #189 (thanks to John Dell)
- added raising of
KeyMappingError
ifkey_mapping
refers to a non-existent key - added option
duplicate_header_suffix
(thanks to Skye Shaw) When given a non-nil string, it uses the suffix to append numbering 2..n to duplicate headers. If your code will need to process arbitrary CSV files, please setduplicate_header_suffix
.
-
fixed bug with trailing col_sep characters, introduced in 1.4.0
-
Fix deprecation warning in Ruby 3.0.3 / $INPUT_RECORD_SEPARATOR (thanks to Joel Fouse )
-
changed default for
comment_regexp
to benil
for a safer default behavior (thanks to David Lazar) Note This no longer assumes that lines starting with#
are comments. If you want to treat lines starting with '#' as comments, usecomment_regexp: /\A#/
- fixed issue with simplecov
- minor fix: also support
col_sep: :auto
- added simplecov
- dropped GPL license, smarter_csv is now only using the MIT License
- added experimental option
col_sep: 'auto
to auto-detect the column separator (issue #183) The default behavior is still to assume,
is the column separator. - fixed buggy behavior when using
remove_empty_values: false
(issue #168) - fixed Ruby 3.0 deprecation
-
fix bug for key_mappings (issue #181)
The values of thekey_mappings
hash will now be used "as is", and no longer forced to be symbolsUsers with existing code with
--key_mappings
need to change their code to- either use symbols in the
key_mapping
hash - or change the expected keys from symbols to strings
- either use symbols in the
- fix bug for key_mappings (issue #181)
The values of the
key_mappings
hash will now be used "as is", and no longer forced to be symbols
- fix deprecation warnings on Ruby 2.7 (thank to Diego Salido)
- fixing error caused by calling f.close when we do not hand in a file
- fixing issue #136 with comments in CSV files
- fixing error class hierarchy
- using Rails blank? if it's available
- fixed regression / test
- fuxed quote_char interpolation for headers, but not data (thanks to Colin Petruno)
- bugfix (thanks to Joshua Smith for reporting)
- add default validation that a header can only appear once
- add option
required_headers
- fix issue with invalid byte sequences in header (issue #103, thanks to Dave Myron)
- fix issue with invalid byte sequences in multi-line data (thanks to Ivan Ushakov)
- analyze only 500 characters by default when
:row_sep => :auto
is used. added optionrow_sep_auto_chars
to change the default if necessary. (thanks to Matthieu Paret)
- fixing UTF-8 related bug which was introduced in 1.1.2 (thanks to Tirdad C.)
- added warning when options indicate UTF-8 processing, but input filehandle is not opened with r:UTF-8 option
- added option
invalid_byte_sequence
(thanks to polycarpou) - added comments on handling of UTF-8 encoding when opening from File vs. OpenURI (thanks to KevinColemanInc)
- added option to
skip_lines
(thanks to wal) - added option to
force_utf8
encoding (thanks to jordangraft) - bugfix if no headers in input data (thanks to esBeee)
- ensure input file is closed (thanks to waldyr)
- improved verbose output (thankd to benmaher)
- improved documentation
- added feature :value_converters, which allows parsing of dates, money, and other things (thanks to Raphaël Bleuse, Lucas Camargo de Almeida, Alejandro)
- added error if :headers_in_file is set to false, and no :user_provided_headers are given (thanks to innhyu)
- added support to convert dashes to underscore characters in headers (thanks to César Camacho)
- fixing automatic detection of \r\n line-endings (thanks to feens)
- added option :keep_original_headers to keep CSV-headers as-is (thanks to Benjamin Thouret)
- added support for multi-line fields / csv fields containing CR (thanks to Chris Hilton) (issue #31)
- added option to set :row_sep to :auto , for automatic detection of the row-separator (issue #22)
- :convert_values_to_numeric option can now be qualified with :except or :only (thanks to Hugo Lepetit)
- removed deprecated
process_csv
method
- new option:
- :remove_unmapped_keys to completely ignore columns which were not mapped with :key_mapping (thanks to Dave Sanders)
- added GPL-2 and MIT license to GEM spec file; if you need another license contact me
- added RSpec tests
- bugfix : fixed issue #18 - fixing issue with last chunk not being properly returned (thanks to Jordan Running)
- added RSpec tests
- bugfix : fixed issue #14 - passing options along to CSV.parse (thanks to Marcos Zimmermann)
- bugfix : fixed issue #13 with negative integers and floats not being correctly converted (thanks to Graham Wetzler)
- bugfix : fixed issue with nil values in inputs with quote-char (thanks to Félix Bellanger)
- new options:
- :force_simple_split : to force simiple splitting on :col_sep character for non-standard CSV-files. e.g. without properly escaped :quote_char
- :verbose : print out line number while processing (to track down problems in input files)
- allowing process to work with objects with a 'readline' method (thanks to taq)
- added options:
- :file_encoding : defaults to utf8 (thanks to MrTin, Paxa)
- bugfix : quoted fields are now correctly parsed
- bugfix : for :headers_in_file option
- renamed the following options:
- :strip_whitepace_from_values => :strip_whitespace - removes leading/trailing whitespace from headers and values
- added the following options:
- :strip_whitepace_from_values - removes leading/trailing whitespace from values
- added more options for dealing with headers:
- :user_provided_headers ,user provided Array with header strings or symbols, to precisely define what the headers should be, overriding any in-file headers (default: nil)
- :headers_in_file , if the file contains headers as the first line (default: true)
-
added the following options:
- :downcase_header
- :strings_as_keys
- :remove_zero_values
- :remove_values_matching
- :remove_empty_hashes
- :convert_values_to_numeric
-
renamed the following options:
- :remove_empty_fields => :remove_empty_values
- renamed
SmarterCSV.process_csv
toSmarterCSV.process
.