credit_card_sanitizer 0.6.6 → 0.6.7

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 +4 -4
  2. data/lib/credit_card_sanitizer.rb +4 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0a1bcb3b9e319ba15d1325e89e16c21d1c2d487
4
- data.tar.gz: edded07867b2a92df9d9658d6c96309c6671ab3c
3
+ metadata.gz: ed76d9a9522df05c6dd170d26ea92106d17a57f3
4
+ data.tar.gz: 2d674bd758d3de26a702d7934fecc385c3cf10eb
5
5
  SHA512:
6
- metadata.gz: fd547cccef9a67b0ce0e7dd7ede7c187039d99579a20f9fe7a016360c4d10f4c2a5709c5a05c78dd9dd91e5b6ed564fff6f895634903bece1521b63e7568a9ec
7
- data.tar.gz: a7f01d88f3df25734d9d6b8fab519ecd9a0594259c4fc6f8e626b4ddeb3b89018dd07ece08a2bc347c29b910db68b4d4672d5df02244a70cce881197d8a07bec
6
+ metadata.gz: 6c4c88de4bc7357bb5897ca7f0eb18a472951fd62d63623ca0a37d28b859f3d4891c727cbf44e73920f8bae87f2abca5760532a1ee53f4b4cf89beb9717aa14c
7
+ data.tar.gz: b55b8fcdf570998f1c4663d435e260b31962e3522fbf97e1b4230c2cef6809e42767de7657aa44390138586b8c122f9080cb360a20600c5971af93711d412cb5
@@ -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>.*)/)
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.7
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: 2018-02-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: luhn_checksum