csv 3.2.4 → 3.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +16 -0
  3. data/lib/csv/version.rb +1 -1
  4. data/lib/csv.rb +40 -0
  5. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ef88fc9b205f8f64c5e817b22f121d5d03534c155cb8d27dc9d87aa62e6b7e0
4
- data.tar.gz: e12b86cee946837a96ae609314a50246e2135fab855dca58e800de1ddc50e524
3
+ metadata.gz: 1abbfa01e0e5085077c3a58da0042477dfc0863cfb613f523a1cd0f6d577e0d9
4
+ data.tar.gz: a80f49679422de5da4543cc5359dc0105ce49be86f76333bc50a2ea75345a1b0
5
5
  SHA512:
6
- metadata.gz: d663d0917d63315e4fc5802f9538727731f39ea06997adea485f5f137f37639f0791db1f9697476e7d0c4a8048a0339b9e4fb7aecd79f3ec8ee8eb24a4cb676e
7
- data.tar.gz: f9d22fe50d227b8f8ca0d075ed0fbf1f39a10bf59a1adb68835fede727f3d1dfd1d2f88754caa1098fe9c24df738c71b29ae5fc3080a25d80df484f76530344e
6
+ metadata.gz: f71291c830c9ac8d77ec16d0acf036e633867c91370032e3f4e26aa5f4f4bfd7e2c726c9bc320c2295de34485bef14abde70de44e052e4e954466ceeeae6e9dd
7
+ data.tar.gz: 2f619e6608556aaeaabdbf3b3116201d9a4f43eb20b313023d153e9ae03e34a17e10919d373afdd64f39f9edaeb813871e43e4fbb3a46e2dc3fc80d47214307c
data/NEWS.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # News
2
2
 
3
+ ## 3.2.5 - 2022-08-26
4
+
5
+ ### Improvements
6
+
7
+ * Added `CSV.generate_lines`.
8
+ [[GitHub#255](https://github.com/ruby/csv/issues/255)]
9
+ [Reported by OKURA Masafumi]
10
+ [[GitHub#256](https://github.com/ruby/csv/pull/256)]
11
+ [Patch by Eriko Sugiyama]
12
+
13
+ ### Thanks
14
+
15
+ * OKURA Masafumi
16
+
17
+ * Eriko Sugiyama
18
+
3
19
  ## 3.2.4 - 2022-08-22
4
20
 
5
21
  ### Improvements
data/lib/csv/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  class CSV
4
4
  # The version of the installed library.
5
- VERSION = "3.2.4"
5
+ VERSION = "3.2.5"
6
6
  end
data/lib/csv.rb CHANGED
@@ -1465,6 +1465,46 @@ class CSV
1465
1465
  (new(str, **options) << row).string
1466
1466
  end
1467
1467
 
1468
+ # :call-seq:
1469
+ # CSV.generate_lines(rows)
1470
+ # CSV.generate_lines(rows, **options)
1471
+ #
1472
+ # Returns the \String created by generating \CSV from
1473
+ # using the specified +options+.
1474
+ #
1475
+ # Argument +rows+ must be an \Array of row. Row is \Array of \String or \CSV::Row.
1476
+ #
1477
+ # Special options:
1478
+ # * Option <tt>:row_sep</tt> defaults to <tt>"\n"</tt> on Ruby 3.0 or later
1479
+ # and <tt>$INPUT_RECORD_SEPARATOR</tt> (<tt>$/</tt>) otherwise.:
1480
+ # $INPUT_RECORD_SEPARATOR # => "\n"
1481
+ # * This method accepts an additional option, <tt>:encoding</tt>, which sets the base
1482
+ # Encoding for the output. This method will try to guess your Encoding from
1483
+ # the first non-+nil+ field in +row+, if possible, but you may need to use
1484
+ # this parameter as a backup plan.
1485
+ #
1486
+ # For other +options+,
1487
+ # see {Options for Generating}[#class-CSV-label-Options+for+Generating].
1488
+ #
1489
+ # ---
1490
+ #
1491
+ # Returns the \String generated from an
1492
+ # CSV.generate_lines(['foo', '0'], ['bar', '1'], ['baz', '2']) # => "foo,0\nbar,1\nbaz.2\n"
1493
+ #
1494
+ # ---
1495
+ #
1496
+ # Raises an exception
1497
+ # # Raises NoMethodError (undefined method `find' for :foo:Symbol)
1498
+ # CSV.generate_lines(:foo)
1499
+ #
1500
+ def generate_lines(rows, **options)
1501
+ self.generate(**options) do |csv|
1502
+ rows.each do |row|
1503
+ csv << row
1504
+ end
1505
+ end
1506
+ end
1507
+
1468
1508
  #
1469
1509
  # :call-seq:
1470
1510
  # open(file_path, mode = "rb", **options ) -> new_csv
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.4
4
+ version: 3.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
8
8
  - Kouhei Sutou
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-22 00:00:00.000000000 Z
12
+ date: 2022-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -71,7 +71,7 @@ description: The CSV library provides a complete interface to CSV files and data
71
71
  It offers tools to enable you to read and write to and from Strings or IO objects,
72
72
  as needed.
73
73
  email:
74
- -
74
+ -
75
75
  - kou@cozmixng.org
76
76
  executables: []
77
77
  extensions: []
@@ -128,7 +128,7 @@ licenses:
128
128
  - Ruby
129
129
  - BSD-2-Clause
130
130
  metadata: {}
131
- post_install_message:
131
+ post_install_message:
132
132
  rdoc_options:
133
133
  - "--main"
134
134
  - README.md
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  requirements: []
148
148
  rubygems_version: 3.4.0.dev
149
- signing_key:
149
+ signing_key:
150
150
  specification_version: 4
151
151
  summary: CSV Reading and Writing
152
152
  test_files: []