confidential_info_redactor_lite 0.0.25 → 0.0.26

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: 1e6584e5ec77fa94af369f94094b9b299ca07202
4
- data.tar.gz: dea7c2fa65b217d6b5eb5c6851028b2ca3b78b4f
3
+ metadata.gz: e5acaf81f53e7390182f433c0904c0046cd6b887
4
+ data.tar.gz: 7463858f0d108d8cfb4bfe5c4794ccf9c2dceb03
5
5
  SHA512:
6
- metadata.gz: 6de045b28a80c2d57889bd601737b12ede3aa3374c5ac4c6e6b95706ce12db478b49006818b47459250937d30e1f6577a5ffb2a5989fb1c2ec1940917ff38251
7
- data.tar.gz: 9e9ffe65a2fc50b82064fd66a56b537ce4b4943de63102bc2d1a909084781f5a56023fe1d3ecb7391137e07868c0abbe84e302219232b22da950c07276001416
6
+ metadata.gz: b688792d2d55b1b09b13e41b77e0a3b45571632ea78d371373025a2c6f8a805a622f4f322610a4ef1a0ac6a260a6c8630e539220f1b384115b2f24d98e7eb5f2
7
+ data.tar.gz: a2b71134454512b86b6388ab1f06cd75dc736fa9c8778501aeca2eee87bdccd95ac1b0646d57674359be9f667533c52cee28f8e91766217e588a86fa0c6eca0b
@@ -110,10 +110,14 @@ module ConfidentialInfoRedactorLite
110
110
 
111
111
  def redact_emails_html(txt)
112
112
  redacted_text = redact_emails(txt).gsub(/\>\s#{Regexp.escape(token_text)}\s\</, ">#{token_text}<").gsub(/\>\s#{Regexp.escape(number_text)}\s\</, ">#{number_text}<").gsub(/\>\s#{Regexp.escape(date_text)}\s\</, ">#{date_text}<").gsub(/\>\s#{Regexp.escape(email_text)}\s\</, ">#{email_text}<").gsub(/\>\s#{Regexp.escape(hyperlink_text)}\s\</, ">#{hyperlink_text}<")
113
- original_sentence_array = txt.split(' ')
114
- redacted_sentence_array = redacted_text.split(' ')
115
- diff = original_sentence_array - redacted_sentence_array
116
- 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 }
113
+ if language.eql?('ja')
114
+ final_email_tokens = txt.scan(/([\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+)/i).map { |token| token[0] }
115
+ else
116
+ original_sentence_array = txt.split(' ')
117
+ redacted_sentence_array = redacted_text.split(' ')
118
+ diff = original_sentence_array - redacted_sentence_array
119
+ 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 }
120
+ end
117
121
  [redacted_text.gsub(/(?<=[^\>])#{Regexp.escape(email_text)}/, "<span class='confidentialEmail'>#{email_text}</span>"), final_email_tokens]
118
122
  end
119
123
 
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  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.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias