confidential_info_redactor_lite 0.0.23 → 0.0.24
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: 9761f67ff135e132a20ef01c222b4f22faf131f1
|
4
|
+
data.tar.gz: 2d85c726798fc13bf87bcc9089fc866e66f40230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6c6c47fc76d60e8e05dc48fd92ebc4321eca1fc72a3d52a3ea9ac9976b4c60dcd400b5ab7587e39980396f49b107590ee2eb34d21d321ba891b247e2ff9fc62
|
7
|
+
data.tar.gz: f584cb53e3e713b1a2f91011926c85d9ec479786e6fe4ece719f57619ddb70011d54e823641ed65526f3a07c080d8b116e25c0bb429a576e264f20eb1053a0e0
|
@@ -12,6 +12,10 @@ module ConfidentialInfoRedactorLite
|
|
12
12
|
# Rubular: http://rubular.com/r/mpVSeaKwdY
|
13
13
|
DIGIT_ONLY_YEAR_LAST_REGEX = /\d{4}[12]\d{3}\D/
|
14
14
|
|
15
|
+
JA_DATE_REGEX_LONG = /[0123456789]+年[0123456789]+月[0123456789]+日/
|
16
|
+
|
17
|
+
JA_DATE_REGEX_SHORT = /[0123456789]+月[0123456789]+日/
|
18
|
+
|
15
19
|
attr_reader :string, :dow, :dow_abbr, :months, :months_abbr
|
16
20
|
def initialize(string:, dow:, dow_abbr:, months:, months_abbr:)
|
17
21
|
@string = string
|
@@ -32,6 +36,8 @@ module ConfidentialInfoRedactorLite
|
|
32
36
|
dow_abbr.each do |day|
|
33
37
|
counter +=1 if string.include?('day')
|
34
38
|
end
|
39
|
+
new_string = new_string.gsub(JA_DATE_REGEX_LONG, '<redacted date>')
|
40
|
+
new_string = new_string.gsub(JA_DATE_REGEX_SHORT, '<redacted date>')
|
35
41
|
if counter > 0
|
36
42
|
dow_abbr.each do |day|
|
37
43
|
months.each do |month|
|
@@ -11,6 +11,11 @@ RSpec.describe ConfidentialInfoRedactorLite::Date do
|
|
11
11
|
let(:de_months) { %w(januar februar märz april mai juni juli august september oktober november dezember) }
|
12
12
|
let(:de_month_abbr) { %w(jan jän feb märz apr mai juni juli aug sep sept okt nov dez) }
|
13
13
|
|
14
|
+
let(:ja_dow) { %w(月曜日 火曜日 水曜日 木曜日 金曜日 土曜日 日曜日) }
|
15
|
+
let(:ja_dow_abbr) { %w(月 火 水 木 金 土 日) }
|
16
|
+
let(:ja_months) { %w(1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月 1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月) }
|
17
|
+
let(:ja_month_abbr) { %w(1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月 1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月) }
|
18
|
+
|
14
19
|
context '#includes_date?' do
|
15
20
|
it 'returns true if the string includes a date #001' do
|
16
21
|
string = 'Today is Monday, April 4th, 2011, aka 04/04/2011.'
|
@@ -277,6 +282,14 @@ RSpec.describe ConfidentialInfoRedactorLite::Date do
|
|
277
282
|
expect(ws.replace).to eq(' <redacted date> ')
|
278
283
|
end
|
279
284
|
end
|
285
|
+
|
286
|
+
context 'Japanese (ja)' do
|
287
|
+
it 'replaces the date occurences in a string #001' do
|
288
|
+
string = '2011年12月31日です。'
|
289
|
+
ws = ConfidentialInfoRedactorLite::Date.new(string: string, dow: ja_dow, dow_abbr: ja_dow_abbr, months: ja_months, months_abbr: ja_month_abbr)
|
290
|
+
expect(ws.replace).to eq('<redacted date>です。')
|
291
|
+
end
|
292
|
+
end
|
280
293
|
end
|
281
294
|
|
282
295
|
context '#replace_number_only_date' 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: 0.0.
|
4
|
+
version: 0.0.24
|
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-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|