confidential_info_redactor 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7c9a3022b0122037ea64027a97f943cc753ac89
4
- data.tar.gz: 77397cc9d846338bb693f1fc809c3811b286cc85
3
+ metadata.gz: 1233d3ddc47135630231617aaebbabe48bdcaef5
4
+ data.tar.gz: 009da140352b1929a471a6a214f110369a6e7d22
5
5
  SHA512:
6
- metadata.gz: e07f637b20ca03bb595f540a9e631d2b78fd8f1b739073d79b06b2fa1caafde0882c6190b4d572b278779fddf7a7a49a69f2c96690de9410a57bbd17b364b738
7
- data.tar.gz: 5ce788d7905e95ee76f92a9edd572e015d68e794986e1c26a9bb1a74e9cce0edd285dedcafd828d2a8ec71e8f632a04fa8295b07fdea4a5e23454b4de317d59f
6
+ metadata.gz: 2f09ed5dbe85f303577d3e1d11d61e83157e06fbb8764ef7b6b86960ce1265b9e560b8a880494264214399386156b405e24d1cb12cad90ec02ab8cbd13089a90
7
+ data.tar.gz: 5048ecb8b50262c157e2b6cd02b7d14d1f5f5c446ef5299df7a3efdf7efe1660301a22827b06208f96cab90a3c7d6d85d79c5c7d8f1e55e85799f4feaa3be9e4
@@ -75,7 +75,7 @@ module ConfidentialInfoRedactor
75
75
 
76
76
  def redact_tokens(txt)
77
77
  tokens.sort_by{ |x| x.split.count }.reverse.each do |token|
78
- txt.gsub!(/(?<=\s|^|\")#{Regexp.escape(token)}/, "#{token_text}")
78
+ txt.gsub!(/(?<=\s|^|\")#{Regexp.escape(token)}(?=\W|$)/, "#{token_text}")
79
79
  end
80
80
  txt
81
81
  end
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactor
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -175,5 +175,11 @@ RSpec.describe ConfidentialInfoRedactor::Redactor do
175
175
  text = 'LEGAL DISCLAIMER - CLA will not be held reponsible for changes.'
176
176
  expect(described_class.new(text: text, language: 'en', tokens: tokens, number_text: '**redacted number**', date_text: '^^redacted date^^', token_text: '*****').redact).to eq("LEGAL DISCLAIMER - ***** will not be held reponsible for changes.")
177
177
  end
178
+
179
+ it 'redacts all confidential information from a text #007' do
180
+ tokens = ['Trans']
181
+ text = 'My Transformation - avoid Trans.'
182
+ expect(described_class.new(text: text, language: 'en', tokens: tokens, number_text: '**redacted number**', date_text: '^^redacted date^^', token_text: '*****', hyperlink_text: '*****', email_text: '*****').redact).to eq('My Transformation - avoid *****.')
183
+ end
178
184
  end
179
185
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confidential_info_redactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias