fast_regexp 0.6.1-aarch64-linux → 0.6.2-aarch64-linux
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/fast_regexp/version.rb +1 -1
- data/lib/fast_regexp.rb +14 -6
- 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: 631f8758ae432269424c547c8ea613ed475fc95d589f8d77eda6a9157a303297
|
|
4
|
+
data.tar.gz: a7c2d5cf6328d43d2bb73692adfefcac19d1ffbdf22e7a91b3b053d02a53a195
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c9ce826241c325c128c72be6da2f4d3d5a3eb4a67f09b973bc752a2a1b1fdf6de8ee1515a89af5326df90a2726de2cd341dd888815ae1db34be73e6393ddd9b
|
|
7
|
+
data.tar.gz: 7cc23ef4cdde598acf331187818e639ca846ecc8294958248d822d8fbd3f731d9da7a6021017b13b136660f982fc770201475d0e67a9755912a74a622e996016
|
data/lib/fast_regexp/version.rb
CHANGED
data/lib/fast_regexp.rb
CHANGED
|
@@ -45,13 +45,21 @@ module Fast
|
|
|
45
45
|
allocate.tap { |re| re.send(:initialize, translated, original: pattern, **opts) }
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# Bulk-compile a
|
|
49
|
-
# of regex constants in one shot:
|
|
48
|
+
# Bulk-compile a set of patterns. Two call shapes:
|
|
50
49
|
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
# Fast::Regexp.create_many(word: '\w+', num: '\d+')
|
|
51
|
+
# # => { word: #<Fast::Regexp ...>, num: #<Fast::Regexp ...> }
|
|
52
|
+
#
|
|
53
|
+
# Fast::Regexp.create_many('\w+', '\d+')
|
|
54
|
+
# # => [#<Fast::Regexp ...>, #<Fast::Regexp ...>]
|
|
55
|
+
#
|
|
56
|
+
# Mixing the two raises ArgumentError — pick one shape per call.
|
|
57
|
+
def create_many(*patterns, **named)
|
|
58
|
+
if !patterns.empty? && !named.empty?
|
|
59
|
+
raise ArgumentError, "create_many accepts positional patterns OR keyword patterns, not both"
|
|
60
|
+
end
|
|
61
|
+
return named.transform_values { |pat| new(pat) } if patterns.empty?
|
|
62
|
+
patterns.map { |pat| new(pat) }
|
|
55
63
|
end
|
|
56
64
|
|
|
57
65
|
private
|