csv.rb: tail commas

* lib/csv.rb (CSV::Converters, CSV::DEFAULT_OPTIONS): supply tail
  commas for further elements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-18 03:55:29 +00:00
parent 3bf1c09c7a
commit a6e055f4a1

View File

@ -949,7 +949,8 @@ class CSV
# To add a combo field, the value should be an Array of names. Combo fields # To add a combo field, the value should be an Array of names. Combo fields
# can be nested with other combo fields. # can be nested with other combo fields.
# #
Converters = { integer: lambda { |f| Converters = {
integer: lambda { |f|
Integer(f.encode(ConverterEncoding)) rescue f Integer(f.encode(ConverterEncoding)) rescue f
}, },
float: lambda { |f| float: lambda { |f|
@ -972,7 +973,8 @@ class CSV
f f
end end
}, },
all: [:date_time, :numeric] } all: [:date_time, :numeric],
}
# #
# This Hash holds the built-in header converters of CSV that can be accessed # This Hash holds the built-in header converters of CSV that can be accessed
@ -1018,7 +1020,8 @@ class CSV
# <b><tt>:force_quotes</tt></b>:: +false+ # <b><tt>:force_quotes</tt></b>:: +false+
# <b><tt>:skip_lines</tt></b>:: +nil+ # <b><tt>:skip_lines</tt></b>:: +nil+
# #
DEFAULT_OPTIONS = { col_sep: ",", DEFAULT_OPTIONS = {
col_sep: ",",
row_sep: :auto, row_sep: :auto,
quote_char: '"', quote_char: '"',
field_size_limit: nil, field_size_limit: nil,
@ -1029,7 +1032,8 @@ class CSV
header_converters: nil, header_converters: nil,
skip_blanks: false, skip_blanks: false,
force_quotes: false, force_quotes: false,
skip_lines: nil }.freeze skip_lines: nil,
}.freeze
# #
# This method will return a CSV instance, just like CSV::new(), but the # This method will return a CSV instance, just like CSV::new(), but the