confidential_info_redactor_lite 1.0.7 → 1.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 513a500576d83e2caf15ad2bfe3a6456951c4d50
|
4
|
+
data.tar.gz: 746a022cc529b41737fc60a40f82617ce3eaa731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04cf1bb7cefd6e0e4dded00472b074c487ee64750a447c016648707ba2f82dd2785772c9a1aa3c8425d39b6ac5bfb7d4158e4cc9318ef87658902998d49d5c2b
|
7
|
+
data.tar.gz: 89b189d9896b4dc33d600e89d9746618ee3183555dd5a76dbb06c550142c5f19323d1f01be43081b1a1d3fe41301e14153b8f9d653bd71674a286d6f0baa1958
|
@@ -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+((
|
8
|
+
NUMBER_REGEX = /(?<=\A|\A\()[^(]?\d+((,|\.|\/)*\d)*(\D?\s|\s|[[:cntrl:]]|[[:space:]]|\.?\s|\.$|$)|(?<=[[:cntrl:]]|[[:space:]]|\s|\s\(|\s'|\s‘)[^('‘]?\d+((,|\.|\/)*\d)*\"*(?=(\D?\s|\s|[[:cntrl:]]|[[:space:]]|\.?\s|\.$|$))|(?<=\s)\d+(nd|th|st)|(?<=\s)\d+\/\d+\"*(?=\s)|(?<=\()\S{1}\d+(?=\))|(?<=\s{1})\S{1}\d+\z|^\d+$|(?<=\A|\A\(|\s|[[:cntrl:]]|[[:space:]]|\s\()[^(]?\d+((,|\.|\/)*\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
|
|
@@ -179,6 +179,31 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
|
|
179
179
|
text = "Page 1500"
|
180
180
|
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)[1]).to eq(["1500"])
|
181
181
|
end
|
182
|
+
|
183
|
+
it 'surrounds the redacted numbers in spans and return the redacted numbers from a text #005' do
|
184
|
+
text = "Maximale Maschinenbreite – 3.900 mm (Gesamtlänge), 3.500 mm (Traversen)"
|
185
|
+
expect(described_class.new(language: 'de', dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr, number_text: "*****").numbers_html(text)[1]).to eq(["3.900 mm", "3.500 mm"])
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'surrounds the redacted numbers in spans and return the redacted numbers from a text #006' do
|
189
|
+
text = "Maschinenlänge – 1.225 mm"
|
190
|
+
expect(described_class.new(language: 'de', dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr, number_text: "*****").numbers_html(text)[1]).to eq(["1.225 mm"])
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'surrounds the redacted numbers in spans and return the redacted numbers from a text #007' do
|
194
|
+
text = "600 V 60 Hz 3 Ph zzgl. Erdung"
|
195
|
+
expect(described_class.new(language: 'de', dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr, number_text: "*****").numbers_html(text)[1]).to eq(["600 V", "60 Hz", "3 Ph"])
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'surrounds the redacted numbers in spans and return the redacted numbers from a text #008' do
|
199
|
+
text = "380/415V 50/60Hz 3Ph plus neutral plus earth"
|
200
|
+
expect(described_class.new(language: 'de', dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr, number_text: "*****").numbers_html(text)[1]).to eq(["380/415V", "50/60Hz", "3Ph"])
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'surrounds the redacted numbers in spans and return the redacted numbers from a text #009' do
|
204
|
+
text = "380/415 V 50/60 Hz 3Ph zzgl. neutral zzgl. Erdung"
|
205
|
+
expect(described_class.new(language: 'de', dow: de_dow, dow_abbr: de_dow_abbr, months: de_months, months_abbr: de_month_abbr, number_text: "*****").numbers_html(text)[1]).to eq(["380/415 V", "50/60 Hz", "3Ph"])
|
206
|
+
end
|
182
207
|
end
|
183
208
|
|
184
209
|
describe '#emails' do
|
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: 1.0.
|
4
|
+
version: 1.0.8
|
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: 2016-03-
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|