confidential_info_redactor_lite 0.0.29 → 0.0.30

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: f622b9cce7af328a6f1169bcabe6786fb41f2ef8
4
- data.tar.gz: 4a6f62357987063ab19313b45393c61643e2337f
3
+ metadata.gz: a7d80063ebb28414556f61547b421f497e5be218
4
+ data.tar.gz: 41c3cd11ad1f756ad649911b3d8be1b3b298e2a7
5
5
  SHA512:
6
- metadata.gz: 06dd58ce4d78bd8b03d821d5d55b26a28fd690f7011ed51748046600eadf1818d25f496cde52ffd3df7609bdafe662bd417aeec15980b59d1ccc8d5d3d93ec0f
7
- data.tar.gz: 02187c3f5779df5e715382dfaf93efa98ab3b77d9efe4045b6827354010860fdd40acfc7bcecf131a95f855ba59e46f0b676c747f6b15ca85e5bf2b6f1cfb282
6
+ metadata.gz: 5f4b8ef9aa7fdd86687cfde695204b115951ec4435ad1be6794ed85b036d09aea9321821e9149288d4e229d2a3944a810a247a5b0ea7520ae3a25076627fdca6
7
+ data.tar.gz: 6b85b88e0cd05997a80e6fb0c53a1febf183f839734efe6392a82e1d90a91fced4582d7e0c2ce3197b4cf3332abf37cb1c0a1106ea6ccaf8ab817be9399e5254
@@ -96,7 +96,7 @@ module ConfidentialInfoRedactorLite
96
96
  diff = original_sentence_array - redacted_sentence_array
97
97
  final_hyperlinks_tokens = diff.map { |token| token[-1].eql?('.') ? token[0...-1] : token }.map { |token| token[-1].eql?(')') ? token[0...-1] : token }.map { |token| token[0].eql?('(') ? token[1..token.length] : token }
98
98
  end
99
- [redacted_text.gsub(/(?<=[^\>])#{Regexp.escape(hyperlink_text)}/, "<span class='confidentialHyperlinks'>#{hyperlink_text}</span>"), final_hyperlinks_tokens]
99
+ [redacted_text.gsub(/(?<=[^\>]|\A)#{Regexp.escape(hyperlink_text)}/, "<span class='confidentialHyperlinks'>#{hyperlink_text}</span>"), final_hyperlinks_tokens]
100
100
  end
101
101
 
102
102
  def redact_numbers_html(txt)
@@ -109,7 +109,7 @@ module ConfidentialInfoRedactorLite
109
109
  diff = original_sentence_array - redacted_sentence_array
110
110
  final_number_tokens = diff.map { |token| token[-1].eql?('.') ? token[0...-1] : token }.map { |token| token[-1].eql?(')') ? token[0...-1] : token }.map { |token| token[0].eql?('(') ? token[1..token.length] : token }
111
111
  end
112
- [redacted_text.gsub(/(?<=[^\>])#{Regexp.escape(number_text)}/, "<span class='confidentialNumber'>#{number_text}</span>"), final_number_tokens]
112
+ [redacted_text.gsub(/(?<=[^\>]|\A)#{Regexp.escape(number_text)}/, "<span class='confidentialNumber'>#{number_text}</span>"), final_number_tokens]
113
113
  end
114
114
 
115
115
  def redact_emails_html(txt)
@@ -122,7 +122,7 @@ module ConfidentialInfoRedactorLite
122
122
  diff = original_sentence_array - redacted_sentence_array
123
123
  final_email_tokens = diff.map { |token| token[-1].eql?('.') ? token[0...-1] : token }.map { |token| token[-1].eql?(')') ? token[0...-1] : token }.map { |token| token[0].eql?('(') ? token[1..token.length] : token }
124
124
  end
125
- [redacted_text.gsub(/(?<=[^\>])#{Regexp.escape(email_text)}/, "<span class='confidentialEmail'>#{email_text}</span>"), final_email_tokens]
125
+ [redacted_text.gsub(/(?<=[^\>]|\A)#{Regexp.escape(email_text)}/, "<span class='confidentialEmail'>#{email_text}</span>"), final_email_tokens]
126
126
  end
127
127
 
128
128
  def redact_dates_html(txt)
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "0.0.29"
2
+ VERSION = "0.0.30"
3
3
  end
@@ -269,5 +269,11 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
269
269
  text = 'LEGAL DISCLAIMER - CLA will not be held reponsible for changes.'
270
270
  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.")
271
271
  end
272
+
273
+ it 'redacts all confidential information from a text #004' do
274
+ tokens = []
275
+ text = '1984 was a good year.'
276
+ 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_html).to eq("<span class='confidentialNumber'>**number**</span> was a good year.")
277
+ end
272
278
  end
273
279
  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.29
4
+ version: 0.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias