ruby-changes:63723
From: Burdette <ko1@a...>
Date: Tue, 24 Nov 2020 09:34:30 +0900 (JST)
Subject: [ruby-changes:63723] 98d52d873e (master): [ruby/csv] Organize page Recipes better (#176)
https://git.ruby-lang.org/ruby.git/commit/?id=98d52d873e From 98d52d873ef17414a83b3bc27f8d7e10163ccba2 Mon Sep 17 00:00:00 2001 From: Burdette Lamar <BurdetteLamar@Y...> Date: Fri, 18 Sep 2020 17:00:06 -0500 Subject: [ruby/csv] Organize page Recipes better (#176) https://github.com/ruby/csv/commit/338b7f0d57 diff --git a/doc/csv/recipes.rdoc b/doc/csv/recipes.rdoc index eda18f6..1ba3c44 100644 --- a/doc/csv/recipes.rdoc +++ b/doc/csv/recipes.rdoc @@ -1,33 +1,46 @@ https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L1 == Recipes === Contents -- {Parsing}[#label-Parsing] - - {Parse from String Without Headers}[#label-Parse+from+String+Without+Headers] - - {Parse from String with Headers}[#label-Parse+from+String+with+Headers] - - {Parse from File Without Headers}[#label-Parse+from+File+Without+Headers] - - {Parse from File with Headers}[#label-Parse+from+File+with+Headers] - - {Parse from IO Stream Without Headers}[#label-Parse+from+IO+Stream+Without+Headers] - - {Parse from IO Stream with Headers}[#label-Parse+from+IO+Stream+with+Headers] -- {Generating}[#label-Generating] - - {Generate to String Without Headers}[#label-Generate+to+String+Without+Headers] - - {Generate to String with Headers}[#label-Generate+to+String+with+Headers] - - {Generate to File Without Headers}[#label-Generate+to+File+Without+Headers] - - {Generate to File with Headers}[#label-Generate+to+File+with+Headers] - - {Generate to IO Stream Without Headers}[#label-Generate+to+IO+Stream+Without+Headers] - - {Generate to IO Stream with Headers}[#label-Generate+to+IO+Stream+with+Headers] -- {Filtering}[#label-Filtering] - - {Filter String to String Without Headers}[#label-Filter+String+to+String+Without+Headers] - - {Filter String to String with Headers}[#label-Filter+String+to+String+with+Headers] - - {Filter String to IO Stream Without Headers}[#label-Filter+String+to+IO+Stream+Without+Headers] - - {Filter String to IO Stream with Headers}[#label-Filter+String+to+IO+Stream+with+Headers] - - {Filter IO Stream to String Without Headers}[#label-Filter+IO+Stream+to+String+Without+Headers] - - {Filter IO Stream to String with Headers}[#label-Filter+IO+Stream+to+String+with+Headers] - - {Filter IO Stream to IO Stream Without Headers}[#label-Filter+IO+Stream+to+IO+Stream+Without+Headers] - - {Filter IO Stream to IO Stream with Headers}[#label-Filter+IO+Stream+to+IO+Stream+with+Headers] - -=== Parsing - -==== Parse from \String Without Headers + +- {Parsing: Source Formats}[#label-Parsing-3A+Source+Formats] + - {Parse from String}[#label-Parse+from+String] + - {Parse from String Without Headers}[#label-Parse+from+String+Without+Headers] + - {Parse from String with Headers}[#label-Parse+from+String+with+Headers] + - {Parse from File}[#label-Parse+from+File] + - {Parse from File Without Headers}[#label-Parse+from+File+Without+Headers] + - {Parse from File with Headers}[#label-Parse+from+File+with+Headers] + - {Parse from IO Stream}[#label-Parse+from+IO+Stream] + - {Parse from IO Stream Without Headers}[#label-Parse+from+IO+Stream+Without+Headers] + - {Parse from IO Stream with Headers}[#label-Parse+from+IO+Stream+with+Headers] +- {Generating: Output Formats}[#label-Generating-3A+Output+Formats] + - {Generate to String}[#label-Generate+to+String] + - {Generate to String Without Headers}[#label-Generate+to+String+Without+Headers] + - {Generate to String with Headers}[#label-Generate+to+String+with+Headers] + - {Generate to File}[#label-Generate+to+File] + - {Generate to File Without Headers}[#label-Generate+to+File+Without+Headers] + - {Generate to File with Headers}[#label-Generate+to+File+with+Headers] + - {Generate to IO Stream}[#label-Generate+to+IO+Stream] + - {Generate to IO Stream Without Headers}[#label-Generate+to+IO+Stream+Without+Headers] + - {Generate to IO Stream with Headers}[#label-Generate+to+IO+Stream+with+Headers] +- {Filtering: Source and Output Formats}[#label-Filtering-3A+Source+and+Output+Formats] + - {Filter String to String}[#label-Filter+String+to+String] + - {Filter String to String Without Headers}[#label-Filter+String+to+String+Without+Headers] + - {Filter String to String with Headers}[#label-Filter+String+to+String+with+Headers] + - {Filter String to IO Stream}[#label-Filter+String+to+IO+Stream] + - {Filter String to IO Stream Without Headers}[#label-Filter+String+to+IO+Stream+Without+Headers] + - {Filter String to IO Stream with Headers}[#label-Filter+String+to+IO+Stream+with+Headers] + - {Filter IO Stream to String}[#label-Filter+IO+Stream+to+String] + - {Filter IO Stream to String Without Headers}[#label-Filter+IO+Stream+to+String+Without+Headers] + - {Filter IO Stream to String with Headers}[#label-Filter+IO+Stream+to+String+with+Headers] + - {Filter IO Stream to IO Stream}[#label-Filter+IO+Stream+to+IO+Stream] + - {Filter IO Stream to IO Stream Without Headers}[#label-Filter+IO+Stream+to+IO+Stream+Without+Headers] + - {Filter IO Stream to IO Stream with Headers}[#label-Filter+IO+Stream+to+IO+Stream+with+Headers] + +=== Parsing: Source Formats + +==== Parse from \String + +===== Parse from \String Without Headers \Class method CSV.parse can read a source \String all at once, and so may have memory resource implications: @@ -43,7 +56,7 @@ Output: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L56 ["bar", "1"] ["baz", "2"] -==== Parse from \String with Headers +===== Parse from \String with Headers \Class method CSV.parse can read a source \String all at once, and so may have memory resource implications: @@ -59,7 +72,9 @@ Ouput: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L72 #<CSV::Row "Name":"bar" "Value":"1"> #<CSV::Row "Name":"baz" "Value":"2"> -==== Parse from \File Without Headers +==== Parse from \File + +===== Parse from \File Without Headers \Class method CSV.read can read a file all at once: string = "foo,0\nbar,1\nbaz,2\n" @@ -76,7 +91,7 @@ Output: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L91 ["bar", "1"] ["baz", "2"] -==== Parse from \File with Headers +===== Parse from \File with Headers Instance method CSV#read can reada file all at once: string = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" @@ -93,7 +108,9 @@ Output: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L108 #<CSV::Row "Name":"bar" "Value":"1"> #<CSV::Row "Name":"baz" "Value":"2"> -==== Parse from \IO Stream Without Headers +==== Parse from \IO Stream + +===== Parse from \IO Stream Without Headers \Class method CSV.parse can read an \IO stream all at once: string = "foo,0\nbar,1\nbaz,2\n" @@ -114,7 +131,7 @@ Output: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L131 ["bar", "1"] ["baz", "2"] -==== Parse from \IO Stream with Headers +===== Parse from \IO Stream with Headers \Class method CSV.parse can read an \IO stream all at once: string = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" @@ -135,7 +152,7 @@ Output: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L152 #<CSV::Row "Name":"bar" "Value":"1"> #<CSV::Row "Name":"baz" "Value":"2"> -=== Generating +=== Generating: Output Formats ==== Generate to \String Without Headers @@ -150,7 +167,9 @@ that are to be generated: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L167 end output_string # => "Foo,0\nBar,1\nBaz,2\n" -==== Generate to \String with Headers +==== Generate to \String + +===== Generate to \String with Headers \Class method CSV.generate can generate to a \String. @@ -163,7 +182,7 @@ that are to be generated: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L182 end output_string # => "Name,Value\nFoo,0\nBar,1\nBaz,2\n" -==== Generate to \File Without Headers +===== Generate to \File Without Headers \Class method CSV.open can generate to a \File. @@ -177,7 +196,9 @@ that are to be generated: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L196 end p File.read(path) # => "Foo,0\nBar,1\nBaz,2\n" -==== Generate to \File with Headers +==== Generate to \File + +===== Generate to \File with Headers \Class method CSV.open can generate to a \File. @@ -191,7 +212,9 @@ that are to be generated: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L212 end p File.read(path) # => "Name,Value\nFoo,0\nBar,1\nBaz,2\n" -==== Generate to \IO Stream Without Headers +==== Generate to \IO Stream + +===== Generate to \IO Stream Without Headers \Class method CSV.new can generate \CSV data to an \IO stream: path = 't.csv' @@ -215,12 +238,14 @@ that are to be generated: https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L238 end p File.read(path) # => "Name,Value\nFoo,0\nBar,1\nBaz,2\n" -=== Filtering +=== Filtering: Source and Output Formats \Class method CSV.filter provides a Unix-style filter for \CSV data. -The input \CSV data is processed to form output \CSV data. +The source \CSV data is processed to form output \CSV data. + +==== Filter \String to \String -==== Filter \String to \String Without Headers +===== Filter \String to \String Without Headers in_string = "foo,0\nbar,1\nbaz,2\n" out_string = '' @@ -230,7 +255,7 @@ The input \CSV data is processed to form output \CSV data. https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L255 end out_string # => "FOO,0000\nBAR,1111\nBAZ,2222\n" -==== Filter \String to \String with Headers +===== Filter \String to \String with Headers in_string = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" out_string = '' @@ -240,7 +265,9 @@ The input \CSV data is processed to form output \CSV data. https://github.com/ruby/ruby/blob/trunk/doc/csv/recipes.rdoc#L265 end out_string # => "Name,Value\nFOO,0000\nBAR,1111\nBAZ,2222\n" -==== Filter \String to \IO Stream Without Headers +==== Filter \String to \IO Stream + +===== Filter \String to \IO Stream Without Headers in_string = "foo,0\nbar,1\nbaz,2\n" path = ' (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/