string_splitter 0.7.1 → 0.7.2
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/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/string_splitter.rb +18 -9
- data/lib/string_splitter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa94b66f61dc3f1970d92b7fa4fb01ba0932262338c124592f539a2f3b4e7ca3
|
4
|
+
data.tar.gz: 0b415f82cfe372bdc9fd0e72d26beeb5071fc02f31e6fa5c02606d3837680506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5efaba21a21e25b4b3f54a505f35cf16bba346427dfe4694554de6a1e917160e08cab9be65e80fd7d7407ba82cf5e876fff21ca2607e2da4fc137f3907b2322a
|
7
|
+
data.tar.gz: 37ac5c38859a8ed4036e68d9e588c58c8aa63e6ce2a47066dc1d02b115564cc187c505bec4b066a20981eedb21d210f01d019715ab9d91c9dc88f6e320763a3c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/string_splitter.rb
CHANGED
@@ -219,15 +219,24 @@ class StringSplitter
|
|
219
219
|
elsif delimiter == DEFAULT_DELIMITER && block == ACCEPT_ALL
|
220
220
|
# non-empty separators so -1 is safe
|
221
221
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
222
|
+
# XXX String#split with block was introduced in Ruby 2.6:
|
223
|
+
#
|
224
|
+
# - https://rubyreferences.github.io/rubychanges/2.6.html#stringsplit-with-block
|
225
|
+
#
|
226
|
+
# rather than sniffing, we'll just use the compatible version for now
|
227
|
+
#
|
228
|
+
# if @remove_empty_fields
|
229
|
+
# result = []
|
230
|
+
#
|
231
|
+
# string.split(delimiter, -1) do |field|
|
232
|
+
# result << field unless field.empty?
|
233
|
+
# end
|
234
|
+
# else
|
235
|
+
# result = string.split(delimiter, -1)
|
236
|
+
# end
|
237
|
+
|
238
|
+
result = string.split(delimiter, -1)
|
239
|
+
result = result.reject(&:empty?) if @remove_empty_fields
|
231
240
|
return [result]
|
232
241
|
else
|
233
242
|
splits = parse(string, delimiter)
|