confidential_info_redactor_lite 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03eb24107d3e6999e966dd7a6c876a2ce01d644a
4
- data.tar.gz: 1156cc1c07efb71377d45bf15e34d49890a297a7
3
+ metadata.gz: a2b54289caa5e8a738d1e02c69ca674510ede0f2
4
+ data.tar.gz: 928b1c1e5d72e49c5e0947bea9f88dd26e7aa705
5
5
  SHA512:
6
- metadata.gz: 0d4fa30390a552389ec6f9b43496475b4beefc0faeaaa029fd097e516125001c80305247f42eec4734dd68dd18ce161d18042953b6cc2ad58e0228747ed50be6
7
- data.tar.gz: 7fae890897742922cb278b1873e993a25144e4e5273dd91cd528e2f19f65d058eda2d2efe66204278a83274205026015595fe9fc8ceb38c104ae80176fdd8312
6
+ metadata.gz: ab40cb4a218d185fb19eb4453b46f9a93ff9b21f99ad02b25fdcc81f6bc11bbc99ddc4334a5338660b021cd7c39a30b76e7ed1df3226439503b57f9ea0c6c343
7
+ data.tar.gz: 3fd6f03a99e57462b68edcd1b8b148d35e68c7a82ef694950ab4c8a30dab03e7f0e2ed2c208558d27c59ddaef094d714d296c1e16b589724d29a226f81427902
@@ -5,7 +5,7 @@ module ConfidentialInfoRedactorLite
5
5
  # This class redacts various tokens from a text
6
6
  class Redactor
7
7
  # Rubular: http://rubular.com/r/OI2wQZ0KSl
8
- NUMBER_REGEX = /(?<=\A|\A\()[^(]?\d+((,|\.)*\d)*(\D?\s|\s|\.?\s|\.$|$)|(?<=\s|\s\(|\s'|\s‘)[^('‘]?\d+((,|\.)*\d)*(?=(\D?\s|\s|\.?\s|\.$))|(?<=\s)\d+(nd|th|st)|(?<=\s)\d+\/\d+\"*(?=\s)|(?<=\()\S{1}\d+(?=\))|(?<=\s{1})\S{1}\d+\z|^\d+$/
8
+ NUMBER_REGEX = /(?<=\A|\A\()[^(]?\d+((,|\.)*\d)*(\D?\s|\s|\.?\s|\.$|$)|(?<=\s|\s\(|\s'|\s‘)[^('‘]?\d+((,|\.)*\d)*(?=(\D?\s|\s|\.?\s|\.$|$))|(?<=\s)\d+(nd|th|st)|(?<=\s)\d+\/\d+\"*(?=\s)|(?<=\()\S{1}\d+(?=\))|(?<=\s{1})\S{1}\d+\z|^\d+$|(?<=\A|\A\(|\s|\s\()[^(]?\d+\D{2}(?=($|\s+))/
9
9
  # Rubular: http://rubular.com/r/mxcj2G0Jfa
10
10
  EMAIL_REGEX = /(?<=\A|\s|\()[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+(?=\z|\s|\.|\))/i
11
11
 
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -118,6 +118,21 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
118
118
  text = "1.4,5.3,7.3"
119
119
  expect(described_class.new(language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).numbers_html(text)[1]).to eq(["1.4,5.3,7.3"])
120
120
  end
121
+
122
+ it 'redacts numbers from a text #011' do
123
+ text = "machine width – 3900mm (overall), 3500mm (cross members)"
124
+ expect(described_class.new(language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).numbers_html(text)[1]).to eq(["3900mm", "3500mm"])
125
+ end
126
+
127
+ it 'redacts numbers from a text #012' do
128
+ text = "Maximale Maschinenbreite – 3.900 mm (Gesamtlänge), 3.500 mm (Traversen)"
129
+ expect(described_class.new(language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).numbers_html(text)[1]).to eq(["3.900", "3.500"])
130
+ end
131
+
132
+ it 'redacts numbers from a text #013' do
133
+ text = "Page 4"
134
+ expect(described_class.new(language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr).numbers_html(text)[1]).to eq(["4"])
135
+ end
121
136
  end
122
137
 
123
138
  describe '#numbers_html' do
@@ -130,6 +145,11 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
130
145
  text = 'プロのミニチュアゴルファー2人のサイン。2人の出身国は別であること。(45ポイント;それぞれが別の大陸出身だった場合、5ボーナスポイント。)'
131
146
  expect(described_class.new(language: 'ja', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, number_text: "*****").numbers_html(text)).to eq(["プロのミニチュアゴルファー <span class='confidentialNumber'>*****</span> 人のサイン。 <span class='confidentialNumber'>*****</span> 人の出身国は別であること。( <span class='confidentialNumber'>*****</span> ポイント;それぞれが別の大陸出身だった場合、 <span class='confidentialNumber'>*****</span> ボーナスポイント。)", ["2", "2", "45", "5"]])
132
147
  end
148
+
149
+ it 'surrounds the redacted numbers in spans and return the redacted numbers from a text #003' do
150
+ text = "machine width – 3900mm (overall), 3500mm (cross members)"
151
+ expect(described_class.new(language: 'en', dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, number_text: "*****").numbers_html(text)).to eq(["machine width – <span class='confidentialNumber'>*****</span> (overall), <span class='confidentialNumber'>*****</span> (cross members)", ["3900mm", "3500mm"]])
152
+ end
133
153
  end
134
154
 
135
155
  describe '#emails' do
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: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias