splitcsv 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/splitcsv/splitter.rb +4 -2
- data/lib/splitcsv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e915baa8d22cd2096376c73e16a96b4f8ff416
|
4
|
+
data.tar.gz: c562104344ac1b0b67c94bdae27a8d02d188ae0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fbcfa25704e2d29d638c58f44aad3a8ec8f7e574544ac112fc6951c0e2c3efba1af99c5db23fa8ecb8e203b6e34a69cdf6394ea0b3146f42026471bc2e86eca
|
7
|
+
data.tar.gz: bad45f3fd597ff5cfd9989d5fc3db9f2050909bbad2a06956b1eed94aac58cad499b62dbe366e06966c057f7a3ce7a42d6dcbe8789f9dce42bd1767508e0ecde
|
data/lib/splitcsv/splitter.rb
CHANGED
@@ -8,7 +8,7 @@ module SplitCSV
|
|
8
8
|
csv_dir = File.dirname(csv_path)
|
9
9
|
|
10
10
|
csv_obj = CSV.open(csv_path, :row_sep => :auto, :col_sep => separator)
|
11
|
-
csv_length = csv_obj.readlines.size
|
11
|
+
csv_length = csv_obj.readlines.size - 1;
|
12
12
|
|
13
13
|
# Opnieuw inlezen zodat readline pointer terug aan 0 staat. Na gebruiken van
|
14
14
|
# csv_obj.readlines.size werd "csv_obj" al eens volledig doorlopen
|
@@ -16,10 +16,12 @@ module SplitCSV
|
|
16
16
|
firstline = csv_obj.readline
|
17
17
|
|
18
18
|
for i in 0..((csv_length / maxlength.to_i).ceil) do
|
19
|
+
puts i
|
20
|
+
|
19
21
|
CSV.open("#{csv_dir}/#{csv_basename}_#{i+1}.csv", 'w', :row_sep => :auto, :col_sep => separator) do |csv|
|
20
22
|
csv << firstline
|
21
23
|
|
22
|
-
for j in
|
24
|
+
for j in 1..maxlength.to_i do
|
23
25
|
if (line = csv_obj.readline) != nil
|
24
26
|
csv << line
|
25
27
|
end
|
data/lib/splitcsv/version.rb
CHANGED