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.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/credit_card_sanitizer.rb +5 -2
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d0a1bcb3b9e319ba15d1325e89e16c21d1c2d487
4
- data.tar.gz: edded07867b2a92df9d9658d6c96309c6671ab3c
2
+ SHA256:
3
+ metadata.gz: c39e3333f13f9c1130b5f1b6f6499b7eff6c0dca6c8541e481f8d41c4686a7e9
4
+ data.tar.gz: 69fa1024561a947ffebbad419e8cfe2fdaba89f218f6e6a5dbeade420df77cbf
5
5
  SHA512:
6
- metadata.gz: fd547cccef9a67b0ce0e7dd7ede7c187039d99579a20f9fe7a016360c4d10f4c2a5709c5a05c78dd9dd91e5b6ed564fff6f895634903bece1521b63e7568a9ec
7
- data.tar.gz: a7f01d88f3df25734d9d6b8fab519ecd9a0594259c4fc6f8e626b4ddeb3b89018dd07ece08a2bc347c29b910db68b4d4672d5df02244a70cce881197d8a07bec
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 = /((?:&#43;|\+)|(?:[a-zA-Z][\-+.a-zA-Z\d]{,9}):[^\s>]+)/
47
+ SCHEME_OR_PLUS = /((?:&#43;|\+|\/)|(?:[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) { |expiration_date| "#{expiration_date_boundary}#{expiration_date}#{expiration_date_boundary}" }
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.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: 2018-01-04 00:00:00.000000000 Z
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
- rubyforge_project:
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