csv-monster 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/csvmonster.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGQyZjQyYmQ3ZTllOWVhZDlkYzA5YzFkNWMyNWJhNWM5NjRjNzAwYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzVlMTNlMzhmODNhODFhNjYzODllMzhlODNjNWUzNzU1Yzc5MjQxZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTI5N2ExNjY1YWQ0ZjliOTUzMDZjZmU1YWI3ZDVjM2RkZmU2MWJjYWI0YTYy
|
10
|
+
YmFlNDg2Yjc3Nzk4YjJhZGE3YTllMzBkMmE1MmE2OTllZmQyY2I0Y2UxNjlh
|
11
|
+
YWM0MjAyZGJmYzY0NmE3YmFlZjFiNjJiNmE5YjhhZWFhMzFjNmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODNmYWQ0MjRjNThjZTQwZTgyODQ3ODllNjU4NmQ1ZjJlMmQ1OTM5MmUxOWEy
|
14
|
+
MGJmZDk0MGM3YTM2ODY3MWYxN2NlMmRjNzFhYTYwODdjNzhmZGVhN2UxMjQx
|
15
|
+
NTk1NWVkMDE2MWY1M2I3NGJkMTFkN2Q3YTgzZWNiNGE2NmMzOWE=
|
data/lib/csvmonster.rb
CHANGED
@@ -14,6 +14,7 @@ class CSVMonster
|
|
14
14
|
i=0
|
15
15
|
output_matrix = []
|
16
16
|
trim_return_carriage(fulltext).each_line do |line|
|
17
|
+
5.times { |i| avoid_commas_in_special_strings(line) }
|
17
18
|
output_matrix << trim_line_ends(line).split(delimiter) unless i == 0
|
18
19
|
i+=1
|
19
20
|
end
|
@@ -40,6 +41,10 @@ protected
|
|
40
41
|
File.open(input_file).read
|
41
42
|
end
|
42
43
|
|
44
|
+
def avoid_commas_in_special_strings(text)
|
45
|
+
text.gsub!(/\"(.*),+(.*)\"/, '"\1;\2"')
|
46
|
+
end
|
47
|
+
|
43
48
|
def trim_return_carriage(text)
|
44
49
|
text.gsub!(/\r\n?/, "\n")
|
45
50
|
end
|