confidential_info_redactor_lite 0.0.15 → 0.0.16

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: 456160b2c0748728398a7a5804f40389d141a56a
4
- data.tar.gz: 29194c0181768c1f35b9558e5934c6133a376a41
3
+ metadata.gz: e2d69531dae1c3c8931201a67c912ace893219c9
4
+ data.tar.gz: ce209b425e478c9e4f8db0bb5539be5ca2914594
5
5
  SHA512:
6
- metadata.gz: f8d4a592e035ccadef1c8bd595978d998dfa297064fef08abe396d7b309441b54dfbd5cd02a0aeca231765f25d5316a8d334af5018d3a6244ec40e493db5c653
7
- data.tar.gz: 22d0eea27d9a10fb5f42c8076b713995490ba95918761816cdeee4aa43acfb37248133944c4adcb396959f30bb7cbeb69624c8119abc5fea21c419043b4abfa4
6
+ metadata.gz: ae27ad9ca0c94ac48852758c633990c9e80a0d2ad88022201593617f70849c16544a2a8d43557699e644228f1a92dec42d73324a65efef8832be1075e5af4c71
7
+ data.tar.gz: 1fcad2249e91fc1076fecff92c6243cd408afcacd4b31c7770f4351da34694e09ffc3854617e7bd535c02a8068640bbf6d5e97836617fed5f35e75f82aa7cd15
@@ -174,7 +174,7 @@ module ConfidentialInfoRedactorLite
174
174
 
175
175
  def redact_tokens(txt)
176
176
  tokens.sort_by{ |x| x.split.count }.reverse.each do |token|
177
- txt.gsub!(/#{Regexp.escape(token)}/, "#{token_text}")
177
+ txt.gsub!(/(?<=\s|^|\")#{Regexp.escape(token)}/, "#{token_text}")
178
178
  end
179
179
  txt
180
180
  end
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -232,5 +232,11 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
232
232
  text = 'Coca-Cola announced a merger with Pepsi that will happen on on December 15th, 2020 for $200,000,000,000. Find out more at https://www.merger.com or contact john@merger.com.'
233
233
  expect(described_class.new(text: text, language: 'en', tokens: tokens, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, email_text: '**email**', number_text: '**number**', date_text: '**date**', hyperlink_text: '**url**', token_text: '*****').redact).to eq("***** announced a merger with ***** that will happen on on **date** for **number**. Find out more at **url** or contact **email**.")
234
234
  end
235
+
236
+ it 'redacts all confidential information from a text #002' do
237
+ tokens = ['CLA']
238
+ text = 'LEGAL DISCLAIMER - CLA will not be held reponsible for changes.'
239
+ expect(described_class.new(text: text, language: 'en', tokens: tokens, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, email_text: '**email**', number_text: '**number**', date_text: '**date**', hyperlink_text: '**url**', token_text: '*****').redact).to eq("LEGAL DISCLAIMER - ***** will not be held reponsible for changes.")
240
+ end
235
241
  end
236
242
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confidential_info_redactor_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias