confidential_info_redactor_lite 0.0.32 → 0.0.33

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: 69347cc82e199d28d8bf542fba216c7b8c6d3410
4
- data.tar.gz: ceebbfa4046ba5fd1349d47c6eff0111ad18b091
3
+ metadata.gz: 3663d0bbfe01b799ee393dbd5c7fdf1124c87d42
4
+ data.tar.gz: 978f762e6c496064cfb59995c737895009dd2bcc
5
5
  SHA512:
6
- metadata.gz: 13b2789ed7b91d38fb3963a554b5f7570b13f7ce39891f4a43be479fc59770794d513f74c1c3ea66c1d312a0b3b919644c096ec4a726b529ffd4e23913cf32d1
7
- data.tar.gz: f2a713b84a11c782f452bc2b4279bf5142e2b1ecbc7eb8374f77f924937bd759932cf870a4ecad2416d80adf6bbcbade97b8ff17de249a379e46c754197923ba
6
+ metadata.gz: 73cbcfad95c1100dd4362469b9ddff18852554a05a9542fb25adb8ade73c8ab6980360b39f63c4482fca7cffd8b358c6a41c89e5f038481164c69d3b9254c3c9
7
+ data.tar.gz: 90249a5a9272046f357523970d2e0f9a28dda314b444c122fd60b12f52b8b07b58fa3b807e16890838dc9629006a33d2e962b5b84b70980bc25945f759f702d0
@@ -30,42 +30,52 @@ module ConfidentialInfoRedactorLite
30
30
  end
31
31
 
32
32
  def dates
33
+ return '' if text.nil?
33
34
  redact_dates(text)
34
35
  end
35
36
 
36
37
  def dates_html
38
+ return [] if text.nil?
37
39
  redact_dates_html(text)
38
40
  end
39
41
 
40
42
  def numbers
43
+ return '' if text.nil?
41
44
  redact_numbers(text)
42
45
  end
43
46
 
44
47
  def numbers_html
48
+ return [] if text.nil?
45
49
  redact_numbers_html(text)
46
50
  end
47
51
 
48
52
  def emails
53
+ return '' if text.nil?
49
54
  redact_emails(text)
50
55
  end
51
56
 
52
57
  def emails_html
58
+ return [] if text.nil?
53
59
  redact_emails_html(text)
54
60
  end
55
61
 
56
62
  def hyperlinks
63
+ return '' if text.nil?
57
64
  redact_hyperlinks(text)
58
65
  end
59
66
 
60
67
  def hyperlinks_html
68
+ return [] if text.nil?
61
69
  redact_hyperlinks_html(text)
62
70
  end
63
71
 
64
72
  def proper_nouns
73
+ return '' if text.nil?
65
74
  redact_tokens(text)
66
75
  end
67
76
 
68
77
  def redact
78
+ return '' if text.nil?
69
79
  if ignore_emails
70
80
  redacted_text = text
71
81
  else
@@ -78,6 +88,7 @@ module ConfidentialInfoRedactorLite
78
88
  end
79
89
 
80
90
  def redact_html
91
+ return [] if text.nil?
81
92
  redacted_text = redact_dates_html(text)[0]
82
93
  redacted_text = redact_emails_html(redacted_text)[0]
83
94
  redacted_text = redact_hyperlinks_html(redacted_text)[0]
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.33"
3
3
  end
@@ -8,6 +8,10 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
8
8
  let(:en_month_abbr) { %w(jan feb mar apr jun jul aug sep sept oct nov dec) }
9
9
 
10
10
  describe '#dates' do
11
+ it 'handles nil as a text argument' do
12
+ expect(described_class.new(text: nil, language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).dates).to eq('')
13
+ end
14
+
11
15
  it 'redacts dates from a text #001' do
12
16
  text = 'Coca-Cola announced a merger with Pepsi that will happen on December 15th, 2020 for $200,000,000,000.'
13
17
  expect(described_class.new(text: text, language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).dates).to eq('Coca-Cola announced a merger with Pepsi that will happen on <redacted date> for $200,000,000,000.')
@@ -45,6 +49,10 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
45
49
  end
46
50
 
47
51
  describe '#dates_html' do
52
+ it 'handles nil as a text argument' do
53
+ expect(described_class.new(text: nil, language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, date_text: "*****").dates_html).to eq([])
54
+ end
55
+
48
56
  it 'surrounds the redacted dates in spans and return the redacted dates from a text #001' do
49
57
  text = 'On May 1st, 2000 Coca-Cola announced a merger with Pepsi that will happen on December 15th, 2020.'
50
58
  expect(described_class.new(text: text, language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, date_text: "*****").dates_html).to eq(["On <span class='confidentialDate'>*****</span> Coca-Cola announced a merger with Pepsi that will happen on <span class='confidentialDate'>*****</span>.", ['May 1st, 2000', 'December 15th, 2020']])
@@ -57,6 +65,10 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
57
65
  end
58
66
 
59
67
  describe '#numbers' do
68
+ it 'handles nil as a text argument' do
69
+ expect(described_class.new(text: nil, language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).numbers).to eq('')
70
+ end
71
+
60
72
  it 'redacts numbers from a text #001' do
61
73
  text = 'Coca-Cola announced a merger with Pepsi that will happen on <redacted date> for $200,000,000,000.'
62
74
  expect(described_class.new(text: text, language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).numbers).to eq('Coca-Cola announced a merger with Pepsi that will happen on <redacted date> for <redacted number>.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confidential_info_redactor_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler