omg_validator 0.0.8 → 1.0.0
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.
- data/.yardoc/checksums +14 -17
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/README.markdown +2 -7
- data/README.rdoc +2 -7
- data/doc/OmgValidator.html +31 -26
- data/doc/OmgValidator/Validators.html +30 -24
- data/doc/OmgValidator/Validators/AlphaDashValidator.html +57 -39
- data/doc/OmgValidator/Validators/{DecimalValidator.html → AlphaNumericDashValidator.html} +62 -43
- data/doc/OmgValidator/Validators/AlphaNumericValidator.html +55 -37
- data/doc/OmgValidator/Validators/AlphaValidator.html +55 -37
- data/doc/OmgValidator/Validators/EmailValidator.html +55 -37
- data/doc/OmgValidator/Validators/IpAddressValidator.html +55 -37
- data/doc/OmgValidator/Validators/PhoneNumberValidator.html +56 -38
- data/doc/OmgValidator/Validators/PostalCodeValidator.html +55 -37
- data/doc/OmgValidator/Validators/PostalOrZipCodeValidator.html +55 -37
- data/doc/OmgValidator/Validators/StrongPasswordValidator.html +56 -38
- data/doc/OmgValidator/Validators/UrlValidator.html +56 -40
- data/doc/OmgValidator/Validators/ZipCodeValidator.html +55 -36
- data/doc/_index.html +41 -74
- data/doc/class_list.html +12 -6
- data/doc/css/full_list.css +4 -2
- data/doc/css/style.css +50 -44
- data/doc/file.README.html +32 -28
- data/doc/file_list.html +12 -6
- data/doc/frames.html +20 -5
- data/doc/index.html +32 -28
- data/doc/js/app.js +52 -43
- data/doc/js/full_list.js +9 -9
- data/doc/js/jquery.js +4 -16
- data/doc/method_list.html +25 -43
- data/doc/top-level-namespace.html +25 -18
- data/lib/omg_validator.rb +1 -4
- data/lib/omg_validator/validators/alpha_dash_validator.rb +10 -6
- data/lib/omg_validator/validators/alpha_numeric_dash_validator.rb +25 -0
- data/lib/omg_validator/validators/alpha_numeric_validator.rb +8 -4
- data/lib/omg_validator/validators/alpha_validator.rb +7 -3
- data/lib/omg_validator/validators/email_validator.rb +7 -3
- data/lib/omg_validator/validators/ip_address_validator.rb +7 -3
- data/lib/omg_validator/validators/phone_number_validator.rb +7 -3
- data/lib/omg_validator/validators/postal_code_validator.rb +7 -3
- data/lib/omg_validator/validators/postal_or_zip_code_validator.rb +7 -3
- data/lib/omg_validator/validators/strong_password_validator.rb +7 -3
- data/lib/omg_validator/validators/url_validator.rb +7 -3
- data/lib/omg_validator/validators/zip_code_validator.rb +7 -3
- data/lib/omg_validator/version.rb +1 -1
- data/omg_validator-0.0.7.gem +0 -0
- data/omg_validator-0.0.8.gem +0 -0
- data/test/alpha_dash_validator_test.rb +26 -0
- data/test/alpha_numeric_dash_validator_test.rb +26 -0
- data/test/alpha_numeric_validator_test.rb +26 -0
- data/test/alpha_validator_test.rb +26 -0
- data/test/dummy/app/models/thing.rb +4 -10
- data/test/email_validator_test.rb +26 -0
- data/test/ip_address_validator_test.rb +26 -0
- data/test/support/things.rb +18 -263
- data/test/support/things.yml +109 -0
- metadata +23 -20
- data/doc/OmgValidator/Validators/DateValidator.html +0 -207
- data/doc/OmgValidator/Validators/IntegerValidator.html +0 -209
- data/doc/OmgValidator/Validators/NumericValidator.html +0 -208
- data/lib/omg_validator/validators/date_validator.rb +0 -19
- data/lib/omg_validator/validators/decimal_validator.rb +0 -21
- data/lib/omg_validator/validators/integer_validator.rb +0 -21
- data/lib/omg_validator/validators/numeric_validator.rb +0 -21
- data/test/omg_validator_test.rb +0 -247
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: OmgValidator::Validators::PostalCodeValidator
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,10 +15,12 @@
|
|
15
15
|
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
19
|
-
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
20
21
|
</script>
|
21
22
|
|
23
|
+
|
22
24
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
25
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
@@ -26,36 +28,41 @@
|
|
26
28
|
|
27
29
|
</head>
|
28
30
|
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
31
|
<div id="header">
|
34
32
|
<div id="menu">
|
35
33
|
|
36
|
-
<a href="../../_index.html">Index (P)</a> »
|
34
|
+
<a href="../../_index.html">Index (P)</a> »
|
37
35
|
<span class='title'><span class='object_link'><a href="../../OmgValidator.html" title="OmgValidator (module)">OmgValidator</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="OmgValidator::Validators (module)">Validators</a></span></span>
|
38
36
|
»
|
39
37
|
<span class="title">PostalCodeValidator</span>
|
40
38
|
|
41
|
-
|
39
|
+
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
41
|
</div>
|
44
42
|
|
45
43
|
<div id="search">
|
46
44
|
|
47
|
-
<a
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
48
49
|
|
49
|
-
<a
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
50
54
|
|
51
|
-
<a
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
52
59
|
|
53
60
|
</div>
|
54
61
|
<div class="clear"></div>
|
55
62
|
</div>
|
56
|
-
|
63
|
+
|
57
64
|
<iframe id="search_frame"></iframe>
|
58
|
-
|
65
|
+
|
59
66
|
<div id="content"><h1>Class: OmgValidator::Validators::PostalCodeValidator
|
60
67
|
|
61
68
|
|
@@ -96,22 +103,30 @@
|
|
96
103
|
|
97
104
|
<h2>Overview</h2><div class="docstring">
|
98
105
|
<div class="discussion">
|
99
|
-
|
100
|
-
Checks whether input is a valid postal code
|
101
|
-
|
102
|
-
<p>
|
103
|
-
|
104
|
-
</
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
</
|
106
|
+
|
107
|
+
<p>Checks whether input is a valid postal code</p>
|
108
|
+
|
109
|
+
<p>Matches:</p>
|
110
|
+
|
111
|
+
<pre class="code ruby"><code>L2J 4T5, l2a 9d1, h2o 4g1, h2o4g1</code></pre>
|
112
|
+
|
113
|
+
<p>Does not match:</p>
|
114
|
+
|
115
|
+
<pre class="code ruby"><code>z2n 1n3, aan 2j2, LL2J 4T5, 5j4 f1d</code></pre>
|
109
116
|
|
110
117
|
|
111
118
|
</div>
|
112
119
|
</div>
|
113
120
|
<div class="tags">
|
114
121
|
|
122
|
+
<div class="examples">
|
123
|
+
<p class="tag_title">Examples:</p>
|
124
|
+
|
125
|
+
|
126
|
+
<pre class="example code"><span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:postal_code</span><span class='comma'>,</span> <span class='label'>postal_code:</span> <span class='kw'>true</span></pre>
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
115
130
|
|
116
131
|
</div>
|
117
132
|
|
@@ -142,6 +157,7 @@ matches: L2J 4T5, l2a 9d1, h2o 4g1, h2o4g1 does not match: z2n 1n3, aan
|
|
142
157
|
|
143
158
|
|
144
159
|
|
160
|
+
|
145
161
|
|
146
162
|
|
147
163
|
<span class="summary_desc"><div class='inline'></div></span>
|
@@ -157,34 +173,36 @@ matches: L2J 4T5, l2a 9d1, h2o 4g1, h2o4g1 does not match: z2n 1n3, aan
|
|
157
173
|
|
158
174
|
<div id="instance_method_details" class="method_details_list">
|
159
175
|
<h2>Instance Method Details</h2>
|
160
|
-
|
176
|
+
|
161
177
|
|
162
178
|
<div class="method_details first">
|
163
|
-
<
|
179
|
+
<h3 class="signature first" id="validate_each-instance_method">
|
164
180
|
|
165
181
|
- (<tt>Object</tt>) <strong>validate_each</strong>(record, attribute, value)
|
166
182
|
|
167
183
|
|
168
184
|
|
169
|
-
|
185
|
+
|
186
|
+
|
187
|
+
</h3><table class="source_code">
|
170
188
|
<tr>
|
171
189
|
<td>
|
172
190
|
<pre class="lines">
|
173
191
|
|
174
192
|
|
175
|
-
10
|
176
|
-
11
|
177
|
-
12
|
178
|
-
13
|
179
193
|
14
|
180
194
|
15
|
181
|
-
16
|
195
|
+
16
|
196
|
+
17
|
197
|
+
18
|
198
|
+
19
|
199
|
+
20</pre>
|
182
200
|
</td>
|
183
201
|
<td>
|
184
|
-
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/postal_code_validator.rb', line
|
202
|
+
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/postal_code_validator.rb', line 14</span>
|
185
203
|
|
186
204
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_each'>validate_each</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
187
|
-
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier
|
205
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
188
206
|
<span class='id identifier rubyid_reg'>reg</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$</span><span class='regexp_end'>/i</span></span>
|
189
207
|
<span class='kw'>unless</span> <span class='id identifier rubyid_reg'>reg</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
190
208
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>must be a valid postal code</span><span class='tstring_end'>"</span></span>
|
@@ -198,11 +216,11 @@ matches: L2J 4T5, l2a 9d1, h2o 4g1, h2o4g1 does not match: z2n 1n3, aan
|
|
198
216
|
</div>
|
199
217
|
|
200
218
|
</div>
|
201
|
-
|
219
|
+
|
202
220
|
<div id="footer">
|
203
|
-
Generated on
|
221
|
+
Generated on Sun Sep 23 13:47:01 2012 by
|
204
222
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
205
|
-
0.
|
223
|
+
0.8.2.1 (ruby-1.9.3).
|
206
224
|
</div>
|
207
225
|
|
208
226
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: OmgValidator::Validators::PostalOrZipCodeValidator
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,10 +15,12 @@
|
|
15
15
|
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
19
|
-
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
20
21
|
</script>
|
21
22
|
|
23
|
+
|
22
24
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
25
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
@@ -26,36 +28,41 @@
|
|
26
28
|
|
27
29
|
</head>
|
28
30
|
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
31
|
<div id="header">
|
34
32
|
<div id="menu">
|
35
33
|
|
36
|
-
<a href="../../_index.html">Index (P)</a> »
|
34
|
+
<a href="../../_index.html">Index (P)</a> »
|
37
35
|
<span class='title'><span class='object_link'><a href="../../OmgValidator.html" title="OmgValidator (module)">OmgValidator</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="OmgValidator::Validators (module)">Validators</a></span></span>
|
38
36
|
»
|
39
37
|
<span class="title">PostalOrZipCodeValidator</span>
|
40
38
|
|
41
|
-
|
39
|
+
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
41
|
</div>
|
44
42
|
|
45
43
|
<div id="search">
|
46
44
|
|
47
|
-
<a
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
48
49
|
|
49
|
-
<a
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
50
54
|
|
51
|
-
<a
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
52
59
|
|
53
60
|
</div>
|
54
61
|
<div class="clear"></div>
|
55
62
|
</div>
|
56
|
-
|
63
|
+
|
57
64
|
<iframe id="search_frame"></iframe>
|
58
|
-
|
65
|
+
|
59
66
|
<div id="content"><h1>Class: OmgValidator::Validators::PostalOrZipCodeValidator
|
60
67
|
|
61
68
|
|
@@ -96,22 +103,30 @@
|
|
96
103
|
|
97
104
|
<h2>Overview</h2><div class="docstring">
|
98
105
|
<div class="discussion">
|
99
|
-
|
100
|
-
Checks whether input is a valid postal code or a valid zip code
|
101
|
-
|
102
|
-
<p>
|
103
|
-
|
104
|
-
</
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
</
|
106
|
+
|
107
|
+
<p>Checks whether input is a valid postal code or a valid zip code</p>
|
108
|
+
|
109
|
+
<p>Matches:</p>
|
110
|
+
|
111
|
+
<pre class="code ruby"><code>L2J 4T5, l2a 9d1, h2o 4g1, h2o4g1, 90210, 20037-8001, 12345</code></pre>
|
112
|
+
|
113
|
+
<p>Does not match:</p>
|
114
|
+
|
115
|
+
<pre class="code ruby"><code>z2n 1n3, aan 2j2, LL2J 4T5, 123456, 20037-001, 207-01</code></pre>
|
109
116
|
|
110
117
|
|
111
118
|
</div>
|
112
119
|
</div>
|
113
120
|
<div class="tags">
|
114
121
|
|
122
|
+
<div class="examples">
|
123
|
+
<p class="tag_title">Examples:</p>
|
124
|
+
|
125
|
+
|
126
|
+
<pre class="example code"><span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:zip_code</span><span class='comma'>,</span> <span class='label'>postal_or_zip_code:</span> <span class='kw'>true</span></pre>
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
115
130
|
|
116
131
|
</div>
|
117
132
|
|
@@ -142,6 +157,7 @@ not match: z2n 1n3, aan 2j2, LL2J 4T5, 123456, 20037-001, 207-01
|
|
142
157
|
|
143
158
|
|
144
159
|
|
160
|
+
|
145
161
|
|
146
162
|
|
147
163
|
<span class="summary_desc"><div class='inline'></div></span>
|
@@ -157,34 +173,36 @@ not match: z2n 1n3, aan 2j2, LL2J 4T5, 123456, 20037-001, 207-01
|
|
157
173
|
|
158
174
|
<div id="instance_method_details" class="method_details_list">
|
159
175
|
<h2>Instance Method Details</h2>
|
160
|
-
|
176
|
+
|
161
177
|
|
162
178
|
<div class="method_details first">
|
163
|
-
<
|
179
|
+
<h3 class="signature first" id="validate_each-instance_method">
|
164
180
|
|
165
181
|
- (<tt>Object</tt>) <strong>validate_each</strong>(record, attribute, value)
|
166
182
|
|
167
183
|
|
168
184
|
|
169
|
-
|
185
|
+
|
186
|
+
|
187
|
+
</h3><table class="source_code">
|
170
188
|
<tr>
|
171
189
|
<td>
|
172
190
|
<pre class="lines">
|
173
191
|
|
174
192
|
|
175
|
-
10
|
176
|
-
11
|
177
|
-
12
|
178
|
-
13
|
179
193
|
14
|
180
194
|
15
|
181
|
-
16
|
195
|
+
16
|
196
|
+
17
|
197
|
+
18
|
198
|
+
19
|
199
|
+
20</pre>
|
182
200
|
</td>
|
183
201
|
<td>
|
184
|
-
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/postal_or_zip_code_validator.rb', line
|
202
|
+
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/postal_or_zip_code_validator.rb', line 14</span>
|
185
203
|
|
186
204
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_each'>validate_each</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
187
|
-
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier
|
205
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
188
206
|
<span class='id identifier rubyid_reg'>reg</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)</span><span class='regexp_end'>/i</span></span>
|
189
207
|
<span class='kw'>unless</span> <span class='id identifier rubyid_reg'>reg</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
190
208
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>must be a valid postal or zip code</span><span class='tstring_end'>"</span></span>
|
@@ -198,11 +216,11 @@ not match: z2n 1n3, aan 2j2, LL2J 4T5, 123456, 20037-001, 207-01
|
|
198
216
|
</div>
|
199
217
|
|
200
218
|
</div>
|
201
|
-
|
219
|
+
|
202
220
|
<div id="footer">
|
203
|
-
Generated on
|
221
|
+
Generated on Sun Sep 23 13:47:01 2012 by
|
204
222
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
205
|
-
0.
|
223
|
+
0.8.2.1 (ruby-1.9.3).
|
206
224
|
</div>
|
207
225
|
|
208
226
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: OmgValidator::Validators::StrongPasswordValidator
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,10 +15,12 @@
|
|
15
15
|
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
19
|
-
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
20
21
|
</script>
|
21
22
|
|
23
|
+
|
22
24
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
25
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
@@ -26,36 +28,41 @@
|
|
26
28
|
|
27
29
|
</head>
|
28
30
|
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
31
|
<div id="header">
|
34
32
|
<div id="menu">
|
35
33
|
|
36
|
-
<a href="../../_index.html">Index (S)</a> »
|
34
|
+
<a href="../../_index.html">Index (S)</a> »
|
37
35
|
<span class='title'><span class='object_link'><a href="../../OmgValidator.html" title="OmgValidator (module)">OmgValidator</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="OmgValidator::Validators (module)">Validators</a></span></span>
|
38
36
|
»
|
39
37
|
<span class="title">StrongPasswordValidator</span>
|
40
38
|
|
41
|
-
|
39
|
+
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
41
|
</div>
|
44
42
|
|
45
43
|
<div id="search">
|
46
44
|
|
47
|
-
<a
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
48
49
|
|
49
|
-
<a
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
50
54
|
|
51
|
-
<a
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
52
59
|
|
53
60
|
</div>
|
54
61
|
<div class="clear"></div>
|
55
62
|
</div>
|
56
|
-
|
63
|
+
|
57
64
|
<iframe id="search_frame"></iframe>
|
58
|
-
|
65
|
+
|
59
66
|
<div id="content"><h1>Class: OmgValidator::Validators::StrongPasswordValidator
|
60
67
|
|
61
68
|
|
@@ -96,24 +103,32 @@
|
|
96
103
|
|
97
104
|
<h2>Overview</h2><div class="docstring">
|
98
105
|
<div class="discussion">
|
99
|
-
|
100
|
-
Checks whether password input is a strong password Must contain a least one
|
106
|
+
|
107
|
+
<p>Checks whether password input is a strong password Must contain a least one
|
101
108
|
number, one lower case letter and one upper case letter and must be at
|
102
|
-
least 8 characters
|
103
|
-
|
104
|
-
<p>
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
</
|
109
|
+
least 8 characters</p>
|
110
|
+
|
111
|
+
<p>Matches:</p>
|
112
|
+
|
113
|
+
<pre class="code ruby"><code>ASdj3j3jsS, 8#adCje3, pwd#fdJa9, To34zNbsr30,</code></pre>
|
114
|
+
|
115
|
+
<p>Does not match:</p>
|
116
|
+
|
117
|
+
<pre class="code ruby"><code>password, sdfsdfs3, Jsdsdsdj, G3hn$h</code></pre>
|
111
118
|
|
112
119
|
|
113
120
|
</div>
|
114
121
|
</div>
|
115
122
|
<div class="tags">
|
116
123
|
|
124
|
+
<div class="examples">
|
125
|
+
<p class="tag_title">Examples:</p>
|
126
|
+
|
127
|
+
|
128
|
+
<pre class="example code"><span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>strong_password:</span> <span class='kw'>true</span></pre>
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
117
132
|
|
118
133
|
</div>
|
119
134
|
|
@@ -144,6 +159,7 @@ password, sdfsdfs3, Jsdsdsdj, G3hn$h
|
|
144
159
|
|
145
160
|
|
146
161
|
|
162
|
+
|
147
163
|
|
148
164
|
|
149
165
|
<span class="summary_desc"><div class='inline'></div></span>
|
@@ -159,34 +175,36 @@ password, sdfsdfs3, Jsdsdsdj, G3hn$h
|
|
159
175
|
|
160
176
|
<div id="instance_method_details" class="method_details_list">
|
161
177
|
<h2>Instance Method Details</h2>
|
162
|
-
|
178
|
+
|
163
179
|
|
164
180
|
<div class="method_details first">
|
165
|
-
<
|
181
|
+
<h3 class="signature first" id="validate_each-instance_method">
|
166
182
|
|
167
183
|
- (<tt>Object</tt>) <strong>validate_each</strong>(record, attribute, value)
|
168
184
|
|
169
185
|
|
170
186
|
|
171
|
-
|
187
|
+
|
188
|
+
|
189
|
+
</h3><table class="source_code">
|
172
190
|
<tr>
|
173
191
|
<td>
|
174
192
|
<pre class="lines">
|
175
193
|
|
176
194
|
|
177
|
-
11
|
178
|
-
12
|
179
|
-
13
|
180
|
-
14
|
181
195
|
15
|
182
196
|
16
|
183
|
-
17
|
197
|
+
17
|
198
|
+
18
|
199
|
+
19
|
200
|
+
20
|
201
|
+
21</pre>
|
184
202
|
</td>
|
185
203
|
<td>
|
186
|
-
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/strong_password_validator.rb', line
|
204
|
+
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/strong_password_validator.rb', line 15</span>
|
187
205
|
|
188
206
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_each'>validate_each</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
189
|
-
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier
|
207
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
190
208
|
<span class='id identifier rubyid_reg'>reg</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$</span><span class='regexp_end'>/</span></span>
|
191
209
|
<span class='kw'>unless</span> <span class='id identifier rubyid_reg'>reg</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
192
210
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>must contain at least a number, a lower case letter, a upper case letter and must be at least 8 characters</span><span class='tstring_end'>"</span></span>
|
@@ -200,11 +218,11 @@ password, sdfsdfs3, Jsdsdsdj, G3hn$h
|
|
200
218
|
</div>
|
201
219
|
|
202
220
|
</div>
|
203
|
-
|
221
|
+
|
204
222
|
<div id="footer">
|
205
|
-
Generated on
|
223
|
+
Generated on Sun Sep 23 13:47:01 2012 by
|
206
224
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
207
|
-
0.
|
225
|
+
0.8.2.1 (ruby-1.9.3).
|
208
226
|
</div>
|
209
227
|
|
210
228
|
</body>
|