ruby-changes:62300
From: Burdette <ko1@a...>
Date: Mon, 20 Jul 2020 03:35:53 +0900 (JST)
Subject: [ruby-changes:62300] 544d82f49b (master): [ruby/csv] RDoc: summary lists for options (#154)
https://git.ruby-lang.org/ruby.git/commit/?id=544d82f49b From 544d82f49b4b1486ae2791a35b6e5cce3e1abed1 Mon Sep 17 00:00:00 2001 From: Burdette Lamar <BurdetteLamar@Y...> Date: Thu, 2 Jul 2020 21:06:26 -0500 Subject: [ruby/csv] RDoc: summary lists for options (#154) * RDoc: summary lists for options * Enhanced RDoc for certain attributes and instance methods * Enhanced RDoc for certain attributes and instance methods * Enhanced RDoc for certain attributes and instance methods * Enhanced RDoc for certain attributes and instance methods https://github.com/ruby/csv/commit/72d8a25dc9 diff --git a/doc/csv/options/generating/write_nil_value.rdoc b/doc/csv/options/generating/write_nil_value.rdoc index 8560f64..65d33ff 100644 --- a/doc/csv/options/generating/write_nil_value.rdoc +++ b/doc/csv/options/generating/write_nil_value.rdoc @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/doc/csv/options/generating/write_nil_value.rdoc#L1 ====== Option +write_nil_value+ -Specifies the object that is to be substituted for each +nil+ field. +Specifies the object that is to be substituted for each +nil+-valued field. Default value: CSV::DEFAULT_OPTIONS.fetch(:write_nil_value) # => nil diff --git a/lib/csv.rb b/lib/csv.rb index 6830fd0..20fd25c 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -337,10 +337,30 @@ using CSV::MatchP if CSV.const_defined?(:MatchP) https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L337 # # ==== Options for Parsing # -# :include: ../doc/options/common/col_sep.rdoc +# Options for parsing, described in detail below, include: +# - +row_sep+: Specifies the row separator; used to delimit rows. +# - +col_sep+: Specifies the column separator; used to delimit fields. +# - +quote_char+: Specifies the quote character; used to quote fields. +# - +field_size_limit+: Specifies the maximum field size allowed. +# - +converters+: Specifies the field converters to be used. +# - +unconverted_fields+: Specifies whether unconverted fields are to be available. +# - +headers+: Specifies whether data contains headers, +# or specifies the headers themselves. +# - +return_headers+: Specifies whether headers are to be returned. +# - +header_converters+: Specifies the header converters to be used. +# - +skip_blanks+: Specifies whether blanks lines are to be ignored. +# - +skip_lines+: Specifies how comments lines are to be recognized. +# - +strip+: Specifies whether leading and trailing whitespace are +# to be stripped from fields.. +# - +liberal_parsing+: Specifies whether \CSV should attempt to parse +# non-compliant data. +# - +nil_value+: Specifies the object that is to be substituted for each null (no-text) field. +# - +empty_value+: Specifies the object that is to be substituted for each empty field. # # :include: ../doc/options/common/row_sep.rdoc # +# :include: ../doc/options/common/col_sep.rdoc +# # :include: ../doc/options/common/quote_char.rdoc # # :include: ../doc/options/parsing/field_size_limit.rdoc @@ -369,10 +389,21 @@ using CSV::MatchP if CSV.const_defined?(:MatchP) https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L389 # # ==== Options for Generating # -# :include: ../doc/options/common/col_sep.rdoc +# Options for generating, described in detail below, include: +# - +row_sep+: Specifies the row separator; used to delimit rows. +# - +col_sep+: Specifies the column separator; used to delimit fields. +# - +quote_char+: Specifies the quote character; used to quote fields. +# - +write_headers+: Specifies whether headers are to be written. +# - +force_quotes+: Specifies whether each output field is to be quoted. +# - +quote_empty+: Specifies whether each empty output field is to be quoted. +# - +write_converters+: Specifies the field converters to be used in writing. +# - +write_nil_value+: Specifies the object that is to be substituted for each +nil+-valued field. +# - +write_empty_value+: Specifies the object that is to be substituted for each empty field. # # :include: ../doc/options/common/row_sep.rdoc # +# :include: ../doc/options/common/col_sep.rdoc +# # :include: ../doc/options/common/quote_char.rdoc # # :include: ../doc/options/generating/write_headers.rdoc @@ -1211,11 +1242,11 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L1242 # # Create a \CSV object using a file path: # csv = CSV.open(path) - # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""> + # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> # # Create a \CSV object using an open \File: # csv = CSV.open(File.open(path)) - # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""> + # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> # # --- # @@ -1224,15 +1255,15 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L1255 # # Using a file path: # csv = CSV.open(path) {|csv| p csv} - # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""> + # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> # Output: - # #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""> + # #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> # # Using an open \File: # csv = CSV.open(File.open(path)) {|csv| p csv} - # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""> + # csv # => #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> # Output: - # #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""> + # #<CSV io_type:File io_path:"t.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> # # --- # @@ -1642,51 +1673,44 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L1673 writer if @writer_options[:write_headers] end - # - # The encoded <tt>:col_sep</tt> used in parsing and writing. - # See CSV::new for details. - # + # Returns the encoded column separator; used for parsing and writing; + # see {Option +col_sep+}[#class-CSV-label-Option+col_sep]: + # CSV.new('').col_sep # => "," def col_sep parser.column_separator end - # - # The encoded <tt>:row_sep</tt> used in parsing and writing. - # See CSV::new for details. - # + # Returns the encoded row separator; used for parsing and writing; + # see {Option +row_sep+}[#class-CSV-label-Option+row_sep]: + # CSV.new('').row_sep # => "\n" def row_sep parser.row_separator end - # - # The encoded <tt>:quote_char</tt> used in parsing and writing. - # See CSV::new for details. - # + # Returns the encoded quote character; used for parsing and writing; + # see {Option +quote_char+}[#class-CSV-label-Option+quote_char]: + # CSV.new('').quote_char # => "\"" def quote_char parser.quote_character end - # - # The limit for field size, if any. - # See CSV::new for details. - # + # Returns the limit for field size; used for parsing; + # see {Option +field_size_limit+}[#class-CSV-label-Option+field_size_limit]: + # CSV.new('').field_size_limit # => nil def field_size_limit parser.field_size_limit end - # - # The regex marking a line as a comment. - # See CSV::new for details. - # + # Returns the \Regexp used to identify comment lines; used for parsing; + # see {Option +skip_lines+}[#class-CSV-label-Option+skip_lines]: + # CSV.new('').skip_lines # => nil def skip_lines parser.skip_lines end - # - # Returns the current list of converters in effect. See CSV::new for details. - # Built-in converters will be returned by name, while others will be returned - # as is. - # + # Returns an \Array containing field converters; used for parsing; + # see {Option +converters+}[#class-CSV-label-Option+converters]: + # CSV.new('').converters # => [] def converters parser_fields_converter.map do |converter| name = Converters.rassoc(converter) @@ -1694,19 +1718,17 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L1718 end end - # - # Returns +true+ if unconverted_fields() to parsed results. - # See CSV::new for details. - # + # Returns the value that determines whether unconverted fields are to be + # available; used for parsing; + # see {Option +unconverted_fields+}[#class-CSV-label-Option+unconverted_fields]: + # CSV.new('').unconverted_fields? # => nil def unconverted_fields? parser.unconverted_fields? end - # - # Returns +nil+ if headers will not be used, +true+ if they will but have not - # yet been read, or the actual headers after they have been read. - # See CSV::new for details. - # + # Returns the value that determines whether headers are used; used for parsing; + # see {Option +headers+}[#class-CSV-label-Option+headers]: + # CSV.new('').headers # => nil def headers if @writer @writer.headers @@ -1718,27 +1740,24 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv.rb#L1740 raw_headers end end - # - # Returns +true+ if headers will be returned as a row of results. - # See CSV::new for details. - # + + # Returns the value that determines whether headers are to be returned; used for parsing; + # see {Option +return_headers+}[#class-CSV-label-Option+return_headers]: + # CSV.new('').return_headers? # => false def return_headers? parser.return_headers? end - # - # Returns +true+ if headers are written in output. - # See CSV::new for details. - # + # Returns the value that determines whether header (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/