csv-utils 0.3.17 → 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: 64f2fb9f8282fcb5ba93856ab707e9797ddb4f0195c46ae5564b455527315157
4
- data.tar.gz: a6ccb029fd622dfa4906d644a32ec98bd5ff4deecd35869f0adb76f00445ce2b
3
+ metadata.gz: 440e96f112e783fee10a1649cb0a115ee9b0403dc7696a20bb7d0c79fd212006
4
+ data.tar.gz: de3664cf9e7106693085d87a7f828b11f92118750183cb52bff4ecd6d585308d
5
5
  SHA512:
6
- metadata.gz: 84721ad624e58a68fe4027a596748982531df61640e944b1bb52e2b6adae3ca64d36584a98a3ea74306272f03da3deaec9a32d89497ac73b4051adb559597fb0
7
- data.tar.gz: 1f0097b68da9fee5b4765f7280e8a249318f9d6c2c215ac1174f9a035992b497b31f150e9caf1fd439bffe27fc868bd120ea1b9bf4a521786dc84b29aa82e030
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.17'
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'
@@ -66,6 +66,34 @@ class CSVUtils::CSVIterator
66
66
  end
67
67
  end
68
68
 
69
+ def size
70
+ @src_csv.rewind
71
+ @src_csv.shift
72
+ cnt = 0
73
+ while @src_csv.shift
74
+ cnt +=1
75
+ end
76
+ cnt
77
+ end
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
+
69
97
  private
70
98
 
71
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.17
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-09-28 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