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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1233d3ddc47135630231617aaebbabe48bdcaef5
|
4
|
+
data.tar.gz: 009da140352b1929a471a6a214f110369a6e7d22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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
|