csv 3.2.5 → 3.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +33 -0
- data/lib/csv/table.rb +1 -2
- data/lib/csv/version.rb +1 -1
- data/lib/csv.rb +11 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48581eef7d2903fa52d36b48a8c1596396a5957b166c99ea8dcfd14ffb0dc221
|
4
|
+
data.tar.gz: fa6a5cdd9ade30c0a45f7974dcb43128d5e99cc7bf344e9e5b012993ad081ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f55443919b4ece138c025818a440ed4a6d0bed64917bcb6f6e810e318f4738f9e129371434c8711173e818b5b58e1d4b2ac2987612617922fda74f03bd3a4b
|
7
|
+
data.tar.gz: 0b83b3b64bf5287653054fa8ecfd4e345f5c41a2a0daedbdba355c4d034bc85c917cf87bd9ee1ede54475ec4e31caadaee54cc2553d529e9ba5b0bc1d5806ff0
|
data/NEWS.md
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.2.6 - 2022-12-08
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* `CSV#read` consumes the same lines with other methods like
|
8
|
+
`CSV#shift`.
|
9
|
+
[[GitHub#258](https://github.com/ruby/csv/issues/258)]
|
10
|
+
[Reported by Lhoussaine Ghallou]
|
11
|
+
|
12
|
+
* All `Enumerable` based methods consume the same lines with other
|
13
|
+
methods. This may have a performance penalty.
|
14
|
+
[[GitHub#260](https://github.com/ruby/csv/issues/260)]
|
15
|
+
[Reported by Lhoussaine Ghallou]
|
16
|
+
|
17
|
+
* Simplify some implementations.
|
18
|
+
[[GitHub#262](https://github.com/ruby/csv/pull/262)]
|
19
|
+
[[GitHub#263](https://github.com/ruby/csv/pull/263)]
|
20
|
+
[Patch by Mau Magnaguagno]
|
21
|
+
|
22
|
+
### Fixes
|
23
|
+
|
24
|
+
* Fixed `CSV.generate_lines` document.
|
25
|
+
[[GitHub#257](https://github.com/ruby/csv/pull/257)]
|
26
|
+
[Patch by Sampat Badhe]
|
27
|
+
|
28
|
+
### Thanks
|
29
|
+
|
30
|
+
* Sampat Badhe
|
31
|
+
|
32
|
+
* Lhoussaine Ghallou
|
33
|
+
|
34
|
+
* Mau Magnaguagno
|
35
|
+
|
3
36
|
## 3.2.5 - 2022-08-26
|
4
37
|
|
5
38
|
### Improvements
|
data/lib/csv/table.rb
CHANGED
@@ -890,9 +890,8 @@ class CSV
|
|
890
890
|
if @mode == :row or @mode == :col_or_row # by index
|
891
891
|
@table.delete_if(&block)
|
892
892
|
else # by header
|
893
|
-
deleted = []
|
894
893
|
headers.each do |header|
|
895
|
-
|
894
|
+
delete(header) if yield([header, self[header]])
|
896
895
|
end
|
897
896
|
end
|
898
897
|
|
data/lib/csv/version.rb
CHANGED
data/lib/csv.rb
CHANGED
@@ -1005,7 +1005,7 @@ class CSV
|
|
1005
1005
|
def instance(data = $stdout, **options)
|
1006
1006
|
# create a _signature_ for this method call, data object and options
|
1007
1007
|
sig = [data.object_id] +
|
1008
|
-
options.values_at(*DEFAULT_OPTIONS.keys
|
1008
|
+
options.values_at(*DEFAULT_OPTIONS.keys)
|
1009
1009
|
|
1010
1010
|
# fetch or create the instance for this signature
|
1011
1011
|
@@instances ||= Hash.new
|
@@ -1202,7 +1202,7 @@ class CSV
|
|
1202
1202
|
# parse options for input, output, or both
|
1203
1203
|
in_options, out_options = Hash.new, {row_sep: InputRecordSeparator.value}
|
1204
1204
|
options.each do |key, value|
|
1205
|
-
case key
|
1205
|
+
case key
|
1206
1206
|
when /\Ain(?:put)?_(.+)\Z/
|
1207
1207
|
in_options[$1.to_sym] = value
|
1208
1208
|
when /\Aout(?:put)?_(.+)\Z/
|
@@ -1489,12 +1489,12 @@ class CSV
|
|
1489
1489
|
# ---
|
1490
1490
|
#
|
1491
1491
|
# Returns the \String generated from an
|
1492
|
-
# CSV.generate_lines(['foo', '0'], ['bar', '1'], ['baz', '2']) # => "foo,0\nbar,1\nbaz
|
1492
|
+
# CSV.generate_lines([['foo', '0'], ['bar', '1'], ['baz', '2']]) # => "foo,0\nbar,1\nbaz,2\n"
|
1493
1493
|
#
|
1494
1494
|
# ---
|
1495
1495
|
#
|
1496
1496
|
# Raises an exception
|
1497
|
-
# # Raises NoMethodError (undefined method `
|
1497
|
+
# # Raises NoMethodError (undefined method `each' for :foo:Symbol)
|
1498
1498
|
# CSV.generate_lines(:foo)
|
1499
1499
|
#
|
1500
1500
|
def generate_lines(rows, **options)
|
@@ -2551,7 +2551,13 @@ class CSV
|
|
2551
2551
|
# p row
|
2552
2552
|
# end
|
2553
2553
|
def each(&block)
|
2554
|
-
|
2554
|
+
return to_enum(__method__) unless block_given?
|
2555
|
+
begin
|
2556
|
+
while true
|
2557
|
+
yield(parser_enumerator.next)
|
2558
|
+
end
|
2559
|
+
rescue StopIteration
|
2560
|
+
end
|
2555
2561
|
end
|
2556
2562
|
|
2557
2563
|
# :call-seq:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-08
|
12
|
+
date: 2022-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|