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
data/Rakefile
CHANGED
@@ -0,0 +1,154 @@
|
|
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
|
+
Class: PrivacyMaskTools::Base
|
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 (B)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../PrivacyMaskTools.html" title="PrivacyMaskTools (module)">PrivacyMaskTools</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Base</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>Class: PrivacyMaskTools::Base
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Object</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">PrivacyMaskTools::Base</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
|
+
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<dt class="r2">Extended by:</dt>
|
85
|
+
<dd class="r2"><span class='object_link'><a href="Matcher.html" title="PrivacyMaskTools::Matcher (module)">Matcher</a></span></dd>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r1 last">Defined in:</dt>
|
94
|
+
<dd class="r1 last">lib/privacy_mask_tools/base.rb</dd>
|
95
|
+
|
96
|
+
</dl>
|
97
|
+
<div class="clear"></div>
|
98
|
+
|
99
|
+
<h2>Overview</h2><div class="docstring">
|
100
|
+
<div class="discussion">
|
101
|
+
<p>
|
102
|
+
PrivacyMaskTools::Matcherをincludeしselfで使用できるようにしています
|
103
|
+
</p>
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
<div class="tags">
|
109
|
+
|
110
|
+
<div class="examples">
|
111
|
+
<h3>Examples:</h3>
|
112
|
+
|
113
|
+
<h4><div class='inline'></div></h4>
|
114
|
+
<pre class="example code"><span class='const'>PrivacyMaskTools</span><span class='op'>::</span><span class='const'>Base</span><span class='period'>.</span><span class='id mobile_number_masking'>mobile_number_masking</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id target_text'>target_text</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span></pre>
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<h3 class="inherited">Constants included from <span class='object_link'><a href="Matcher.html" title="PrivacyMaskTools::Matcher (module)">Matcher</a></span></h3>
|
125
|
+
<p class="inherited"><span class='object_link'><a href="Matcher.html#JARGON_MOBILE_NUMBER_REGEXP-constant" title="PrivacyMaskTools::Matcher::JARGON_MOBILE_NUMBER_REGEXP (constant)">JARGON_MOBILE_NUMBER_REGEXP</a></span>, <span class='object_link'><a href="Matcher.html#MOBILE_NUMBER_REGEXP-constant" title="PrivacyMaskTools::Matcher::MOBILE_NUMBER_REGEXP (constant)">MOBILE_NUMBER_REGEXP</a></span></p>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<h2>Method Summary</h2>
|
140
|
+
|
141
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Matcher.html" title="PrivacyMaskTools::Matcher (module)">Matcher</a></span></h3>
|
142
|
+
<p class="inherited"><span class='object_link'><a href="Matcher.html#has_jargon_mobile_number%3F-instance_method" title="PrivacyMaskTools::Matcher#has_jargon_mobile_number? (method)">has_jargon_mobile_number?</a></span>, <span class='object_link'><a href="Matcher.html#has_mobile_number%3F-instance_method" title="PrivacyMaskTools::Matcher#has_mobile_number? (method)">has_mobile_number?</a></span>, <span class='object_link'><a href="Matcher.html#mobile_number_masking-instance_method" title="PrivacyMaskTools::Matcher#mobile_number_masking (method)">mobile_number_masking</a></span></p>
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div id="footer">
|
148
|
+
Generated on Sat Aug 20 06:22:44 2011 by
|
149
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
150
|
+
0.7.2 (ruby-1.9.2).
|
151
|
+
</div>
|
152
|
+
|
153
|
+
</body>
|
154
|
+
</html>
|
@@ -0,0 +1,515 @@
|
|
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
|
+
Module: PrivacyMaskTools::Matcher
|
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 (M)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../PrivacyMaskTools.html" title="PrivacyMaskTools (module)">PrivacyMaskTools</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Matcher</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>Module: PrivacyMaskTools::Matcher
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<dt class="r1">Included in:</dt>
|
74
|
+
<dd class="r1"><span class='object_link'><a href="Base.html" title="PrivacyMaskTools::Base (class)">Base</a></span></dd>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<dt class="r2 last">Defined in:</dt>
|
79
|
+
<dd class="r2 last">lib/privacy_mask_tools/matcher.rb</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
|
85
|
+
<h2>Constant Summary</h2>
|
86
|
+
|
87
|
+
<dl class="constants">
|
88
|
+
|
89
|
+
<dt id="MOBILE_NUMBER_REGEXP-constant" class="">MOBILE_NUMBER_REGEXP =
|
90
|
+
<div class="docstring">
|
91
|
+
<div class="discussion">
|
92
|
+
<p>
|
93
|
+
携帯番号ソフト判定用正規表現
|
94
|
+
</p>
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
<div class="tags">
|
100
|
+
|
101
|
+
</div>
|
102
|
+
</dt>
|
103
|
+
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(([00][7-97-9][00])[-ー)(() ]*([0-90-9]{4})[-ー)(() ]*([0-90-9]{4})(?![0-90-9]))</span><span class='regexp_end'>/</span></span></pre></dd>
|
104
|
+
|
105
|
+
<dt id="JARGON_MOBILE_NUMBER_REGEXP-constant" class="">JARGON_MOBILE_NUMBER_REGEXP =
|
106
|
+
<div class="docstring">
|
107
|
+
<div class="discussion">
|
108
|
+
<p>
|
109
|
+
携帯番号ハード判定用正規表現(丸付数字等も含める)
|
110
|
+
</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
</div>
|
118
|
+
</dt>
|
119
|
+
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(([00oO〇十]?[7-97-9⑦⑧⑨][00十〇])[-ー)(() ]*([0-90-9oO①②③④⑤⑥⑦⑧⑨一二三四五六七八九十〇壱弐参]{4})[-ー)(() ]*([0-90-9oO①②③④⑤⑥⑦⑧⑨一二三四五六七八九十〇壱弐参]{4})(?![0-90-9]))</span><span class='regexp_end'>/</span></span></pre></dd>
|
120
|
+
|
121
|
+
</dl>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<h2>
|
130
|
+
Instance Method Summary
|
131
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
132
|
+
</h2>
|
133
|
+
|
134
|
+
<ul class="summary">
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#has_jargon_mobile_number%3F-instance_method" title="#has_jargon_mobile_number? (instance method)">- (Boolean) <strong>has_jargon_mobile_number?</strong>(text) </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'><p>
|
153
|
+
携帯番号が含まれているかチェックします.
|
154
|
+
</p>
|
155
|
+
</div></span>
|
156
|
+
|
157
|
+
</li>
|
158
|
+
|
159
|
+
|
160
|
+
<li class="public ">
|
161
|
+
<span class="summary_signature">
|
162
|
+
|
163
|
+
<a href="#has_mobile_number%3F-instance_method" title="#has_mobile_number? (instance method)">- (Boolean) <strong>has_mobile_number?</strong>(text, jargon = false) </a>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
</span>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'><p>
|
177
|
+
携帯番号が含まれているかチェックします.
|
178
|
+
</p>
|
179
|
+
</div></span>
|
180
|
+
|
181
|
+
</li>
|
182
|
+
|
183
|
+
|
184
|
+
<li class="public ">
|
185
|
+
<span class="summary_signature">
|
186
|
+
|
187
|
+
<a href="#mobile_number_masking-instance_method" title="#mobile_number_masking (instance method)">- (String) <strong>mobile_number_masking</strong>(text, sub = "*", jargon = false) </a>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</span>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'><p>
|
201
|
+
携帯番号らしき箇所をマスキングします.
|
202
|
+
</p>
|
203
|
+
</div></span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
</ul>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<div id="instance_method_details" class="method_details_list">
|
214
|
+
<h2>Instance Method Details</h2>
|
215
|
+
|
216
|
+
|
217
|
+
<div class="method_details first">
|
218
|
+
<p class="signature first" id="has_jargon_mobile_number?-instance_method">
|
219
|
+
|
220
|
+
- (<tt>Boolean</tt>) <strong>has_jargon_mobile_number?</strong>(text)
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</p><div class="docstring">
|
225
|
+
<div class="discussion">
|
226
|
+
<p>
|
227
|
+
携帯番号が含まれているかチェックします
|
228
|
+
</p>
|
229
|
+
<pre class="code">
|
230
|
+
<span class='id 隠語らしきものも判定します'>隠語らしきものも判定します</span>
|
231
|
+
<span class='id そのため正常な文字列も置換する確率が高くなります'>そのため正常な文字列も置換する確率が高くなります</span>
|
232
|
+
<span class='id 現時点ではテストが不十分です'>現時点ではテストが不十分です</span></pre>
|
233
|
+
|
234
|
+
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
<div class="tags">
|
238
|
+
<h3>Parameters:</h3>
|
239
|
+
<ul class="param">
|
240
|
+
|
241
|
+
<li>
|
242
|
+
|
243
|
+
<span class='name'>チェック対象の文字列</span>
|
244
|
+
|
245
|
+
|
246
|
+
<span class='type'>(<tt>String</tt>)</span>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</li>
|
251
|
+
|
252
|
+
</ul>
|
253
|
+
<h3>Returns:</h3>
|
254
|
+
<ul class="return">
|
255
|
+
|
256
|
+
<li>
|
257
|
+
|
258
|
+
|
259
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
—
|
264
|
+
<div class='inline'><p>
|
265
|
+
含まれている場合 true 含まれていない場合 false
|
266
|
+
</p>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
</ul>
|
272
|
+
|
273
|
+
</div><table class="source_code">
|
274
|
+
<tr>
|
275
|
+
<td>
|
276
|
+
<pre class="lines">
|
277
|
+
|
278
|
+
|
279
|
+
30
|
280
|
+
31
|
281
|
+
32</pre>
|
282
|
+
</td>
|
283
|
+
<td>
|
284
|
+
<pre class="code"><span class="info file"># File 'lib/privacy_mask_tools/matcher.rb', line 30</span>
|
285
|
+
|
286
|
+
<span class='kw'>def</span> <span class='id has_jargon_mobile_number?'>has_jargon_mobile_number?</span><span class='lparen'>(</span><span class='id text'>text</span><span class='rparen'>)</span>
|
287
|
+
<span class='id has_mobile_number?'>has_mobile_number?</span><span class='lparen'>(</span><span class='id text'>text</span><span class='comma'>,</span><span class='kw'>true</span><span class='rparen'>)</span>
|
288
|
+
<span class='kw'>end</span></pre>
|
289
|
+
</td>
|
290
|
+
</tr>
|
291
|
+
</table>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
<div class="method_details ">
|
295
|
+
<p class="signature " id="has_mobile_number?-instance_method">
|
296
|
+
|
297
|
+
- (<tt>Boolean</tt>) <strong>has_mobile_number?</strong>(text, jargon = false)
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
</p><div class="docstring">
|
302
|
+
<div class="discussion">
|
303
|
+
<p>
|
304
|
+
携帯番号が含まれているかチェックします
|
305
|
+
</p>
|
306
|
+
<pre class="code">
|
307
|
+
<span class='id 隠語判定はソフトで、半角全角の携帯番号らしきものはtrueを返します'>隠語判定はソフトで、半角全角の携帯番号らしきものはtrueを返します</span></pre>
|
308
|
+
|
309
|
+
|
310
|
+
</div>
|
311
|
+
</div>
|
312
|
+
<div class="tags">
|
313
|
+
<h3>Parameters:</h3>
|
314
|
+
<ul class="param">
|
315
|
+
|
316
|
+
<li>
|
317
|
+
|
318
|
+
<span class='name'>チェック対象の文字列</span>
|
319
|
+
|
320
|
+
|
321
|
+
<span class='type'>(<tt>String</tt>)</span>
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
</li>
|
326
|
+
|
327
|
+
<li>
|
328
|
+
|
329
|
+
<span class='name'>隠語判定強化フラグ(漢数字・丸付き数値にもマッチ)</span>
|
330
|
+
|
331
|
+
|
332
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
</li>
|
337
|
+
|
338
|
+
</ul>
|
339
|
+
<h3>Returns:</h3>
|
340
|
+
<ul class="return">
|
341
|
+
|
342
|
+
<li>
|
343
|
+
|
344
|
+
|
345
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
—
|
350
|
+
<div class='inline'><p>
|
351
|
+
含まれている場合 true 含まれていない場合 false
|
352
|
+
</p>
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</li>
|
356
|
+
|
357
|
+
</ul>
|
358
|
+
|
359
|
+
</div><table class="source_code">
|
360
|
+
<tr>
|
361
|
+
<td>
|
362
|
+
<pre class="lines">
|
363
|
+
|
364
|
+
|
365
|
+
17
|
366
|
+
18
|
367
|
+
19
|
368
|
+
20</pre>
|
369
|
+
</td>
|
370
|
+
<td>
|
371
|
+
<pre class="code"><span class="info file"># File 'lib/privacy_mask_tools/matcher.rb', line 17</span>
|
372
|
+
|
373
|
+
<span class='kw'>def</span> <span class='id has_mobile_number?'>has_mobile_number?</span><span class='lparen'>(</span><span class='id text'>text</span><span class='comma'>,</span> <span class='id jargon'>jargon</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
|
374
|
+
<span class='id reg'>reg</span> <span class='op'>=</span> <span class='id jargon'>jargon</span> <span class='op'>?</span> <span class='const'>JARGON_MOBILE_NUMBER_REGEXP</span> <span class='op'>:</span> <span class='const'>MOBILE_NUMBER_REGEXP</span>
|
375
|
+
<span class='op'>!</span><span class='id text'>text</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='id reg'>reg</span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
376
|
+
<span class='kw'>end</span></pre>
|
377
|
+
</td>
|
378
|
+
</tr>
|
379
|
+
</table>
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div class="method_details ">
|
383
|
+
<p class="signature " id="mobile_number_masking-instance_method">
|
384
|
+
|
385
|
+
- (<tt>String</tt>) <strong>mobile_number_masking</strong>(text, sub = "*", jargon = false)
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
</p><div class="docstring">
|
390
|
+
<div class="discussion">
|
391
|
+
<p>
|
392
|
+
携帯番号らしき箇所をマスキングします
|
393
|
+
</p>
|
394
|
+
|
395
|
+
|
396
|
+
</div>
|
397
|
+
</div>
|
398
|
+
<div class="tags">
|
399
|
+
|
400
|
+
<div class="examples">
|
401
|
+
<h3>Examples:</h3>
|
402
|
+
|
403
|
+
<h4><div class='inline'></div></h4>
|
404
|
+
<pre class="example code"><span class='id mobile_number_masking'>mobile_number_masking</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>携帯番号 : 090-1234-5678</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
405
|
+
<span class='comment'># => "携帯番号 : xxx-xxxx-xxxx"</span></pre>
|
406
|
+
|
407
|
+
</div>
|
408
|
+
<h3>Parameters:</h3>
|
409
|
+
<ul class="param">
|
410
|
+
|
411
|
+
<li>
|
412
|
+
|
413
|
+
<span class='name'>マスキング対象の文字列</span>
|
414
|
+
|
415
|
+
|
416
|
+
<span class='type'>(<tt>String</tt>)</span>
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
</li>
|
421
|
+
|
422
|
+
<li>
|
423
|
+
|
424
|
+
<span class='name'>マッチした部分の置換文字</span>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='type'>(<tt>String</tt>)</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</li>
|
432
|
+
|
433
|
+
<li>
|
434
|
+
|
435
|
+
<span class='name'>隠語判定を強化フラグ</span>
|
436
|
+
|
437
|
+
|
438
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
</li>
|
443
|
+
|
444
|
+
</ul>
|
445
|
+
<h3>Returns:</h3>
|
446
|
+
<ul class="return">
|
447
|
+
|
448
|
+
<li>
|
449
|
+
|
450
|
+
|
451
|
+
<span class='type'>(<tt>String</tt>)</span>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
—
|
456
|
+
<div class='inline'><p>
|
457
|
+
マスキング後の文字列
|
458
|
+
</p>
|
459
|
+
</div>
|
460
|
+
|
461
|
+
</li>
|
462
|
+
|
463
|
+
</ul>
|
464
|
+
|
465
|
+
</div><table class="source_code">
|
466
|
+
<tr>
|
467
|
+
<td>
|
468
|
+
<pre class="lines">
|
469
|
+
|
470
|
+
|
471
|
+
42
|
472
|
+
43
|
473
|
+
44
|
474
|
+
45
|
475
|
+
46
|
476
|
+
47
|
477
|
+
48
|
478
|
+
49
|
479
|
+
50
|
480
|
+
51
|
481
|
+
52
|
482
|
+
53</pre>
|
483
|
+
</td>
|
484
|
+
<td>
|
485
|
+
<pre class="code"><span class="info file"># File 'lib/privacy_mask_tools/matcher.rb', line 42</span>
|
486
|
+
|
487
|
+
<span class='kw'>def</span> <span class='id mobile_number_masking'>mobile_number_masking</span><span class='lparen'>(</span><span class='id text'>text</span><span class='comma'>,</span> <span class='id sub'>sub</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id jargon'>jargon</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
|
488
|
+
<span class='id reg'>reg</span> <span class='op'>=</span> <span class='id jargon'>jargon</span> <span class='op'>?</span> <span class='const'>JARGON_MOBILE_NUMBER_REGEXP</span> <span class='op'>:</span> <span class='const'>MOBILE_NUMBER_REGEXP</span>
|
489
|
+
<span class='id text'>text</span><span class='period'>.</span><span class='id scan'>scan</span><span class='lparen'>(</span><span class='id reg'>reg</span><span class='rparen'>)</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span>
|
490
|
+
<span class='id replace_word'>replace_word</span> <span class='op'>=</span> <span class='id f'>f</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id dup'>dup</span>
|
491
|
+
<span class='id f'>f</span><span class='period'>.</span><span class='id each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id g'>g</span><span class='comma'>,</span> <span class='id index'>index</span><span class='op'>|</span>
|
492
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id index'>index</span> <span class='op'>==</span> <span class='int'>0</span>
|
493
|
+
<span class='id replace_word'>replace_word</span><span class='period'>.</span><span class='id sub!'>sub!</span><span class='lparen'>(</span><span class='id g'>g</span><span class='comma'>,</span> <span class='id sub'>sub</span><span class='op'>*</span><span class='id g'>g</span><span class='period'>.</span><span class='id size'>size</span><span class='rparen'>)</span>
|
494
|
+
<span class='kw'>end</span>
|
495
|
+
<span class='id text'>text</span> <span class='op'>=</span> <span class='id text'>text</span><span class='period'>.</span><span class='id sub'>sub</span><span class='lparen'>(</span><span class='id f'>f</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id replace_word'>replace_word</span><span class='rparen'>)</span>
|
496
|
+
<span class='kw'>end</span>
|
497
|
+
<span class='id text'>text</span>
|
498
|
+
<span class='kw'>end</span></pre>
|
499
|
+
</td>
|
500
|
+
</tr>
|
501
|
+
</table>
|
502
|
+
</div>
|
503
|
+
|
504
|
+
</div>
|
505
|
+
|
506
|
+
</div>
|
507
|
+
|
508
|
+
<div id="footer">
|
509
|
+
Generated on Sat Aug 20 06:22:44 2011 by
|
510
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
511
|
+
0.7.2 (ruby-1.9.2).
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</body>
|
515
|
+
</html>
|