confidential_info_redactor_lite 1.0.7 → 1.0.8

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: ab6eaa73743d300fc6918935988e050df53c0640
4
- data.tar.gz: cc2fab161debe0f8eddbd9eb48f836896ef2d399
3
+ metadata.gz: 513a500576d83e2caf15ad2bfe3a6456951c4d50
4
+ data.tar.gz: 746a022cc529b41737fc60a40f82617ce3eaa731
5
5
  SHA512:
6
- metadata.gz: 2df1d83ea6d00c0ad7738d420b2b30206c387d420cc511d0d7562aeacf815ef7a0e0d2a37d3416ace7862aad0fc21f0c65885031bf1b8b5c5fc7d0d27785a73c
7
- data.tar.gz: 6ff9977e7f1c2a1355842f9de09eb8539340d79a08bb8580f645858569ae0c6b7b76a1fd29d5050deb02da2e418730ce5c78eca307de0c33f7e09b3fa5398191
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+((,|\.)*\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+))/
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
 
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactorLite
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
@@ -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.7
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-05 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler