csv-utils 0.3.18 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfcbc7a92377a1b5d4dec01847defb5a4b2ac76c3dc65f40ec113c9d2085d2c6
4
- data.tar.gz: bff2e91650ff90feb08e960ab3356d70486759aca7e4ddf54020081d31f2ce18
3
+ metadata.gz: 440e96f112e783fee10a1649cb0a115ee9b0403dc7696a20bb7d0c79fd212006
4
+ data.tar.gz: de3664cf9e7106693085d87a7f828b11f92118750183cb52bff4ecd6d585308d
5
5
  SHA512:
6
- metadata.gz: 7d7db74ed5c52d058fabe0498f9404915c398826be471b8407f839a9eec89c64d797cc9b9f8f1751b89ccd1b80c14165190ec50f595e942f9f0fbc151f544985
7
- data.tar.gz: 90578cb216ba3d5260304a8cd9302bcae3e8b8e892592f7adc75db7536652822e0c729e57a074a99d77472751bfa0c92e2470be0bd7c68393ece4a782e93eb2b
6
+ metadata.gz: 92051057bddc10ad33fd227234088f1cb54f11fe4dba4fcee96db45ca9f8f2327d4923719fd9b7cf741b1914a38014c2a3a5e7efddd3c70f2440935f27dc508d
7
+ data.tar.gz: f1f4eefcdba39c7ae758b2d82a58e4ac578509473458ed7d1efbd7f0fa73b479c90fbdf58bde49ec507927c4fbfef44f00b12a3b9f4268de5aac5d30c8ba4e70
data/csv-utils.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'csv-utils'
5
- s.version = '0.3.18'
5
+ s.version = '0.3.19'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'CSV Utils'
8
8
  s.description = 'Tools for debugging malformed CSV files'
@@ -76,6 +76,24 @@ class CSVUtils::CSVIterator
76
76
  cnt
77
77
  end
78
78
 
79
+ def each_batch(batch_size = 1_000)
80
+ batch = []
81
+
82
+ process_batch_proc = Proc.new do
83
+ yield batch
84
+ batch = []
85
+ end
86
+
87
+ each do |row|
88
+ batch << row
89
+ process_batch_proc.call if batch.size >= batch_size
90
+ end
91
+
92
+ process_batch_proc.call if batch.size > 0
93
+
94
+ nil
95
+ end
96
+
79
97
  private
80
98
 
81
99
  def strip_bom!(col)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-18 00:00:00.000000000 Z
11
+ date: 2022-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inheritance-helper