privacy_mask_tools 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Rakefile +1 -1
- data/doc/PrivacyMaskTools/Base.html +154 -0
- data/doc/PrivacyMaskTools/Matcher.html +515 -0
- data/doc/PrivacyMaskTools.html +131 -0
- data/doc/_index.html +136 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +320 -0
- data/doc/file.README.html +103 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +103 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +150 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +70 -0
- data/doc/top-level-namespace.html +103 -0
- data/lib/privacy_mask_tools/base.rb +2 -0
- data/lib/privacy_mask_tools/matcher.rb +17 -10
- data/lib/privacy_mask_tools/version.rb +2 -1
- metadata +22 -5
@@ -0,0 +1,70 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<base id="base_target" target="_parent" />
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<script type="text/javascript" charset="utf-8">
|
22
|
+
if (window.top.frames.main) {
|
23
|
+
document.getElementById('base_target').target = 'main';
|
24
|
+
document.body.className = 'frames';
|
25
|
+
}
|
26
|
+
</script>
|
27
|
+
<div id="content">
|
28
|
+
<h1 id="full_list_header">Method List</h1>
|
29
|
+
<div id="nav">
|
30
|
+
|
31
|
+
<a target="_self" href="class_list.html">Classes</a>
|
32
|
+
|
33
|
+
<a target="_self" href="method_list.html">Methods</a>
|
34
|
+
|
35
|
+
<a target="_self" href="file_list.html">Files</a>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
<div id="search">Search: <input type="text" /></div>
|
39
|
+
|
40
|
+
<ul id="full_list" class="methods">
|
41
|
+
|
42
|
+
|
43
|
+
<li class="r1 ">
|
44
|
+
<span class='object_link'><a href="PrivacyMaskTools/Matcher.html#has_jargon_mobile_number%3F-instance_method" title="PrivacyMaskTools::Matcher#has_jargon_mobile_number? (method)">#has_jargon_mobile_number?</a></span>
|
45
|
+
|
46
|
+
<small>PrivacyMaskTools::Matcher</small>
|
47
|
+
|
48
|
+
</li>
|
49
|
+
|
50
|
+
|
51
|
+
<li class="r2 ">
|
52
|
+
<span class='object_link'><a href="PrivacyMaskTools/Matcher.html#has_mobile_number%3F-instance_method" title="PrivacyMaskTools::Matcher#has_mobile_number? (method)">#has_mobile_number?</a></span>
|
53
|
+
|
54
|
+
<small>PrivacyMaskTools::Matcher</small>
|
55
|
+
|
56
|
+
</li>
|
57
|
+
|
58
|
+
|
59
|
+
<li class="r1 ">
|
60
|
+
<span class='object_link'><a href="PrivacyMaskTools/Matcher.html#mobile_number_masking-instance_method" title="PrivacyMaskTools::Matcher#mobile_number_masking (method)">#mobile_number_masking</a></span>
|
61
|
+
|
62
|
+
<small>PrivacyMaskTools::Matcher</small>
|
63
|
+
|
64
|
+
</li>
|
65
|
+
|
66
|
+
|
67
|
+
</ul>
|
68
|
+
</div>
|
69
|
+
</body>
|
70
|
+
</html>
|
@@ -0,0 +1,103 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html">Index</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">Top Level Namespace</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Top Level Namespace
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
</dl>
|
75
|
+
<div class="clear"></div>
|
76
|
+
|
77
|
+
<h2>Defined Under Namespace</h2>
|
78
|
+
<p class="children">
|
79
|
+
|
80
|
+
|
81
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="PrivacyMaskTools.html" title="PrivacyMaskTools (module)">PrivacyMaskTools</a></span>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
</p>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<div id="footer">
|
97
|
+
Generated on Sat Aug 20 06:22:44 2011 by
|
98
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
99
|
+
0.7.2 (ruby-1.9.2).
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</body>
|
103
|
+
</html>
|
@@ -1,14 +1,17 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
module PrivacyMaskTools::Matcher
|
4
|
+
# 携帯番号ソフト判定用正規表現
|
4
5
|
MOBILE_NUMBER_REGEXP = /(([00][7-97-9][00])[-ー)(() ]*([0-90-9]{4})[-ー)(() ]*([0-90-9]{4})(?![0-90-9]))/
|
6
|
+
|
7
|
+
# 携帯番号ハード判定用正規表現(丸付数字等も含める)
|
5
8
|
JARGON_MOBILE_NUMBER_REGEXP = /(([00oO〇十]?[7-97-9⑦⑧⑨][00十〇])[-ー)(() ]*([0-90-9oO①②③④⑤⑥⑦⑧⑨一二三四五六七八九十〇壱弐参]{4})[-ー)(() ]*([0-90-9oO①②③④⑤⑥⑦⑧⑨一二三四五六七八九十〇壱弐参]{4})(?![0-90-9]))/
|
6
9
|
|
7
|
-
#
|
10
|
+
# 携帯番号が含まれているかチェックします
|
8
11
|
# 隠語判定はソフトで、半角全角の携帯番号らしきものはtrueを返します
|
9
|
-
# @param String チェック対象の文字列
|
10
|
-
# @param Boolean 隠語判定強化フラグ(漢数字・丸付き数値にもマッチ)
|
11
|
-
# @return Boolean
|
12
|
+
# @param [String] チェック対象の文字列
|
13
|
+
# @param [Boolean] 隠語判定強化フラグ(漢数字・丸付き数値にもマッチ)
|
14
|
+
# @return [Boolean]
|
12
15
|
# 含まれている場合 true
|
13
16
|
# 含まれていない場合 false
|
14
17
|
def has_mobile_number?(text, jargon=false)
|
@@ -20,18 +23,22 @@ module PrivacyMaskTools::Matcher
|
|
20
23
|
# 隠語らしきものも判定します
|
21
24
|
# そのため正常な文字列も置換する確率が高くなります
|
22
25
|
# 現時点ではテストが不十分です
|
23
|
-
# @param String チェック対象の文字列
|
24
|
-
# @return Boolean
|
26
|
+
# @param [String] チェック対象の文字列
|
27
|
+
# @return [Boolean]
|
25
28
|
# 含まれている場合 true
|
26
29
|
# 含まれていない場合 false
|
27
30
|
def has_jargon_mobile_number?(text)
|
28
31
|
has_mobile_number?(text,true)
|
29
32
|
end
|
30
33
|
|
31
|
-
#
|
32
|
-
# @param String マスキング対象の文字列
|
33
|
-
# @param String
|
34
|
-
# @param Boolean
|
34
|
+
# 携帯番号らしき箇所をマスキングします
|
35
|
+
# @param [String] マスキング対象の文字列
|
36
|
+
# @param [String] マッチした部分の置換文字
|
37
|
+
# @param [Boolean] 隠語判定を強化フラグ
|
38
|
+
# @return [String] マスキング後の文字列
|
39
|
+
# @example
|
40
|
+
# mobile_number_masking("携帯番号 : 090-1234-5678")
|
41
|
+
# # => "携帯番号 : xxx-xxxx-xxxx"
|
35
42
|
def mobile_number_masking(text, sub="*", jargon=false)
|
36
43
|
reg = jargon ? JARGON_MOBILE_NUMBER_REGEXP : MOBILE_NUMBER_REGEXP
|
37
44
|
text.scan(reg).each do |f|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: privacy_mask_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &75895030 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.6.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *75895030
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: tapp
|
27
|
-
requirement: &
|
27
|
+
requirement: &75894780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *75894780
|
36
36
|
description: Included methods "has_mobile_number?", "mobile_number_masking"
|
37
37
|
email:
|
38
38
|
- info@namakesugi.net
|
@@ -45,6 +45,23 @@ files:
|
|
45
45
|
- Guardfile
|
46
46
|
- README.markdown
|
47
47
|
- Rakefile
|
48
|
+
- doc/PrivacyMaskTools.html
|
49
|
+
- doc/PrivacyMaskTools/Base.html
|
50
|
+
- doc/PrivacyMaskTools/Matcher.html
|
51
|
+
- doc/_index.html
|
52
|
+
- doc/class_list.html
|
53
|
+
- doc/css/common.css
|
54
|
+
- doc/css/full_list.css
|
55
|
+
- doc/css/style.css
|
56
|
+
- doc/file.README.html
|
57
|
+
- doc/file_list.html
|
58
|
+
- doc/frames.html
|
59
|
+
- doc/index.html
|
60
|
+
- doc/js/app.js
|
61
|
+
- doc/js/full_list.js
|
62
|
+
- doc/js/jquery.js
|
63
|
+
- doc/method_list.html
|
64
|
+
- doc/top-level-namespace.html
|
48
65
|
- init.rb
|
49
66
|
- lib/privacy_mask_tools.rb
|
50
67
|
- lib/privacy_mask_tools/base.rb
|