diff options
author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2020-06-24 16:04:25 -0500 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-07-20 02:32:53 +0900 |
commit | d9eff306f5806c6a1b79019ec44395e4cc816218 (patch) | |
tree | ff5b302f3beba9a165b88d8b95aca8541296d34a /doc/csv/options/parsing/unconverted_fields.rdoc | |
parent | 920a16893ad5b76bcb357d45f2c0b9d91d09268e (diff) |
[ruby/csv] Organize files in doc/ (#145)
https://github.com/ruby/csv/commit/bc9ea859b0
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3332
Diffstat (limited to 'doc/csv/options/parsing/unconverted_fields.rdoc')
-rw-r--r-- | doc/csv/options/parsing/unconverted_fields.rdoc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/csv/options/parsing/unconverted_fields.rdoc b/doc/csv/options/parsing/unconverted_fields.rdoc new file mode 100644 index 0000000000..3e7f839d49 --- /dev/null +++ b/doc/csv/options/parsing/unconverted_fields.rdoc @@ -0,0 +1,27 @@ +====== Option +unconverted_fields+ + +Specifies the boolean that determines whether unconverted field values are to be available. + +Default value: + CSV::DEFAULT_OPTIONS.fetch(:unconverted_fields) # => nil + +The unconverted field values are those found in the source data, +prior to any conversions performed via option +converters+. + +When option +unconverted_fields+ is +true+, +each returned row (\Array or \CSV::Row) has an added method, ++unconverted_fields+, that returns the unconverted field values: + str = <<-EOT + foo,0 + bar,1 + baz,2 + EOT + # Without unconverted_fields + csv = CSV.parse(str, converters: :integer) + csv # => [["foo", 0], ["bar", 1], ["baz", 2]] + csv.first.respond_to?(:unconverted_fields) # => false + # With unconverted_fields + csv = CSV.parse(str, converters: :integer, unconverted_fields: true) + csv # => [["foo", 0], ["bar", 1], ["baz", 2]] + csv.first.respond_to?(:unconverted_fields) # => true + csv.first.unconverted_fields # => ["foo", "0"] |