smarter_csv 1.11.0.pre1 → 1.11.0.pre2
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 +4 -4
- data/lib/smarter_csv/smarter_csv.rb +8 -11
- data/lib/smarter_csv/version.rb +1 -1
- 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: 9027a37c4b29e68fcbc559a6a8285e5076684883612e98b13f116526dadc6e4b
|
4
|
+
data.tar.gz: 43cfa0254ac2caa8ca02a8863fc790f1c56beb0b16e175a16fd947f92eda8c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b2eac35e33bdeb9ec632578207c47f34a08a4595c1ebf04929a7fe302efc3fc08565c0d6fc6454fd538b99cc1c4a5662599a88693e3aa1b80c5c0c7fc1b05e
|
7
|
+
data.tar.gz: 36f622f12d5412ef8919c30a267def315985aef4b3f33c209341a046442795bb66df6c8ebb97399f35e24fd565df658a0e4b7a94d3563831d7ce32facbeab33f
|
@@ -170,22 +170,19 @@ module SmarterCSV
|
|
170
170
|
end
|
171
171
|
|
172
172
|
class << self
|
173
|
+
# Counts the number of quote characters in a line, excluding escaped quotes.
|
174
|
+
# FYI: using Ruby built-in regex processing to determine the number of quotes
|
173
175
|
def count_quote_chars(line, quote_char)
|
174
176
|
return 0 if line.nil? || quote_char.nil? || quote_char.empty?
|
175
177
|
|
176
|
-
|
177
|
-
|
178
|
+
# Escaped quote character (e.g., if quote_char is ", then escaped is \")
|
179
|
+
escaped_quote = Regexp.escape(quote_char)
|
178
180
|
|
179
|
-
|
180
|
-
|
181
|
-
escaped = true
|
182
|
-
else
|
183
|
-
count += 1 if char == quote_char && !escaped
|
184
|
-
escaped = false
|
185
|
-
end
|
186
|
-
end
|
181
|
+
# Pattern to match a quote character not preceded by a backslash
|
182
|
+
pattern = /(?<!\\)(?:\\\\)*#{escaped_quote}/
|
187
183
|
|
188
|
-
|
184
|
+
# Count occurrences
|
185
|
+
line.scan(pattern).count
|
189
186
|
end
|
190
187
|
|
191
188
|
def has_acceleration?
|
data/lib/smarter_csv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smarter_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.0.
|
4
|
+
version: 1.11.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilo Sloboda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|