credit_card_sanitizer 0.6.6 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/credit_card_sanitizer.rb +5 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c39e3333f13f9c1130b5f1b6f6499b7eff6c0dca6c8541e481f8d41c4686a7e9
|
4
|
+
data.tar.gz: 69fa1024561a947ffebbad419e8cfe2fdaba89f218f6e6a5dbeade420df77cbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db8e96b0272a415c3300c2311ba458c6335df036c41e5aa5e0bb8bb8d6157fceca29a90740918526521f73be133910402ce65c470c3c9a6a669ee3fd6550824b
|
7
|
+
data.tar.gz: a2a5d648461566fc101087c12603e361fdc3b38a026c9a920ca1a0ed83819b61d57ab441b63abfa91ad4fbd733b46dd773c13832d231bc106507e41851602ab4
|
@@ -44,7 +44,7 @@ class CreditCardSanitizer
|
|
44
44
|
LINE_NOISE_CHAR = /[^\w\n,()&.\/:;<>]/
|
45
45
|
LINE_NOISE = /#{LINE_NOISE_CHAR}{,5}/
|
46
46
|
NONEMPTY_LINE_NOISE = /#{LINE_NOISE_CHAR}{1,5}/
|
47
|
-
SCHEME_OR_PLUS = /((?:+
|
47
|
+
SCHEME_OR_PLUS = /((?:+|\+|\/)|(?:[a-zA-Z][\-+.a-zA-Z\d]{,9}):[^\s>]+)/
|
48
48
|
NUMBERS_WITH_LINE_NOISE = /#{SCHEME_OR_PLUS}?\d(?:#{LINE_NOISE}\d){10,30}/
|
49
49
|
|
50
50
|
DEFAULT_OPTIONS = {
|
@@ -203,7 +203,10 @@ class CreditCardSanitizer
|
|
203
203
|
|
204
204
|
def without_expiration(text)
|
205
205
|
expiration_date_boundary = SecureRandom.hex.tr('0123456789', 'ABCDEFGHIJ')
|
206
|
-
text.gsub!(EXPIRATION_DATE)
|
206
|
+
text.gsub!(EXPIRATION_DATE) do |expiration_date|
|
207
|
+
match = expiration_date.match(/(?<whitespace>\s*)(?<rest>.*)/m)
|
208
|
+
"#{match[:whitespace]}#{expiration_date_boundary}#{match[:rest]}#{expiration_date_boundary}"
|
209
|
+
end
|
207
210
|
yield
|
208
211
|
text.gsub!(expiration_date_boundary, '')
|
209
212
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credit_card_sanitizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Chapweske
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: luhn_checksum
|
@@ -67,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
|
71
|
-
rubygems_version: 2.6.11
|
70
|
+
rubygems_version: 3.1.6
|
72
71
|
signing_key:
|
73
72
|
specification_version: 4
|
74
73
|
summary: Credit card sanitizer
|