omg_validator 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardoc/checksums +17 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +2 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/README.markdown +53 -0
- data/doc/OmgValidator/Validators/AlphaDashValidator.html +205 -0
- data/doc/OmgValidator/Validators/AlphaNumericValidator.html +205 -0
- data/doc/OmgValidator/Validators/AlphaValidator.html +205 -0
- data/doc/OmgValidator/Validators/DateValidator.html +207 -0
- data/doc/OmgValidator/Validators/DecimalValidator.html +205 -0
- data/doc/OmgValidator/Validators/EmailValidator.html +205 -0
- data/doc/OmgValidator/Validators/IntegerValidator.html +205 -0
- data/doc/OmgValidator/Validators/IpAddressValidator.html +205 -0
- data/doc/OmgValidator/Validators/NumericValidator.html +205 -0
- data/doc/OmgValidator/Validators/PhoneNumberValidator.html +206 -0
- data/doc/OmgValidator/Validators/PostalCodeValidator.html +205 -0
- data/doc/OmgValidator/Validators/PostalOrZipCodeValidator.html +205 -0
- data/doc/OmgValidator/Validators/StrongPasswordValidator.html +206 -0
- data/doc/OmgValidator/Validators/UrlValidator.html +206 -0
- data/doc/OmgValidator/Validators/ZipCodeValidator.html +205 -0
- data/doc/OmgValidator/Validators.html +120 -0
- data/doc/OmgValidator.html +144 -0
- data/doc/_index.html +301 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.README.html +70 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +70 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +167 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +166 -0
- data/doc/top-level-namespace.html +103 -0
- data/lib/omg_validator/validators/alpha_dash_validator.rb +3 -0
- data/lib/omg_validator/validators/alpha_numeric_validator.rb +3 -0
- data/lib/omg_validator/validators/alpha_validator.rb +3 -0
- data/lib/omg_validator/validators/date_validator.rb +3 -0
- data/lib/omg_validator/validators/decimal_validator.rb +3 -0
- data/lib/omg_validator/validators/email_validator.rb +3 -0
- data/lib/omg_validator/validators/integer_validator.rb +3 -0
- data/lib/omg_validator/validators/ip_address_validator.rb +3 -0
- data/lib/omg_validator/validators/numeric_validator.rb +3 -0
- data/lib/omg_validator/validators/phone_number_validator.rb +4 -0
- data/lib/omg_validator/validators/postal_code_validator.rb +3 -0
- data/lib/omg_validator/validators/postal_or_zip_code_validator.rb +3 -0
- data/lib/omg_validator/validators/strong_password_validator.rb +4 -0
- data/lib/omg_validator/validators/url_validator.rb +4 -0
- data/lib/omg_validator/validators/zip_code_validator.rb +3 -0
- data/lib/omg_validator/version.rb +2 -1
- data/lib/omg_validator.rb +2 -0
- data/omg_validator-0.0.4.gem +0 -0
- metadata +41 -11
- data/README.rdoc +0 -3
data/.yardoc/checksums
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
lib/omg_validator.rb cb42ac0e072223a394ca6c628b74959f8f75f1e7
|
2
|
+
lib/omg_validator/version.rb faf0dcfa550fceb1ca0710f3c5b5e66f2117fc36
|
3
|
+
lib/omg_validator/validators/url_validator.rb 6c4d49fcb6ceb26ec507a0018ea1dfedc1ec78ec
|
4
|
+
lib/omg_validator/validators/date_validator.rb f86e6208ec84c95a6cc0d682b5e3cd83b0c17200
|
5
|
+
lib/omg_validator/validators/alpha_validator.rb c0683724253617cc28d9af24f16be5884a04bd9f
|
6
|
+
lib/omg_validator/validators/email_validator.rb 9f07d15949b2fc700ac335d9e5f630a7b932de9c
|
7
|
+
lib/omg_validator/validators/decimal_validator.rb 957306cd04292651acc70930ae421712b059a96c
|
8
|
+
lib/omg_validator/validators/numeric_validator.rb e51ee33b356c126d63f8f51849eabf3e00a5dce1
|
9
|
+
lib/omg_validator/validators/integer_validator.rb dae7461fb49bd775c7f7947037f92fb808dfde70
|
10
|
+
lib/omg_validator/validators/zip_code_validator.rb 2b3a32dcbb0086bcbd54d31b3638636329aa0de1
|
11
|
+
lib/omg_validator/validators/ip_address_validator.rb 7e0a72ea4fedc792c846c0d3d8c014b6157cf628
|
12
|
+
lib/omg_validator/validators/alpha_dash_validator.rb 4f955ac6fd144413373f2b64f6d797f5fefc7dbc
|
13
|
+
lib/omg_validator/validators/postal_code_validator.rb c31a66578e6fe09c78208c39227c85a0369a48d5
|
14
|
+
lib/omg_validator/validators/phone_number_validator.rb 7eb838920c775f1ae70276407de1a12e9e21b7db
|
15
|
+
lib/omg_validator/validators/alpha_numeric_validator.rb f06f72604041574c4045f710011af7d3c8de1f97
|
16
|
+
lib/omg_validator/validators/strong_password_validator.rb 9886612f752a661409990e55cc7577cf31aa36cf
|
17
|
+
lib/omg_validator/validators/postal_or_zip_code_validator.rb 7262496950c0be2624a11a225a958604c6d6768e
|
Binary file
|
data/.yardoc/proxy_types
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omg_validator (0.0.
|
4
|
+
omg_validator (0.0.4)
|
5
5
|
activemodel
|
6
6
|
|
7
7
|
GEM
|
@@ -58,6 +58,7 @@ GEM
|
|
58
58
|
tilt (~> 1.1, != 1.3.0)
|
59
59
|
thor (0.14.6)
|
60
60
|
tilt (1.3.3)
|
61
|
+
yard (0.7.4)
|
61
62
|
|
62
63
|
PLATFORMS
|
63
64
|
ruby
|
@@ -65,3 +66,4 @@ PLATFORMS
|
|
65
66
|
DEPENDENCIES
|
66
67
|
jquery-rails
|
67
68
|
omg_validator!
|
69
|
+
yard
|
data/README.markdown
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# OmgValidator
|
2
|
+
|
3
|
+
OmgValidator is a collection of custom validators for Rails 3.x. These are simple validators that mostly use regular expressions for common validation requirements, including:
|
4
|
+
|
5
|
+
* Alpha-dash characters
|
6
|
+
* Alphanumeric characters
|
7
|
+
* Alpha characters
|
8
|
+
* Dates
|
9
|
+
* Decimal numbers
|
10
|
+
* Email addresses
|
11
|
+
* Integer numbers
|
12
|
+
* IP addresses
|
13
|
+
* Numeric characters
|
14
|
+
* US and Canadian (or compatible) Phone numbers
|
15
|
+
* US and Canadian (or compatible) Postal/Zip Codes
|
16
|
+
* Strong passwords
|
17
|
+
* URL
|
18
|
+
* US (or compatible) Zip Code
|
19
|
+
|
20
|
+
Using the gem is easy. Just add it to your gemfile.
|
21
|
+
|
22
|
+
gem "omg_validator", "~> 0.0.4"
|
23
|
+
|
24
|
+
Run bundle install and then use them in your models. For example:
|
25
|
+
|
26
|
+
validates :postal_code, postal_or_zip_code: true
|
27
|
+
|
28
|
+
Think of this package as a swiss army knife for your validation needs. It larges replaces the need to use validates_format_of validation helper method.
|
29
|
+
|
30
|
+
The decimal, integer, and numeric validators do overlap with functionality in the validates_numericality_of validation helper method. We have kept these in the gem however, as we personally find them easier to use. The validates_numericality_of method is still immensely useful for more complex numeric validations.
|
31
|
+
|
32
|
+
### Contributors
|
33
|
+
|
34
|
+
* Nickolas Kenyeres
|
35
|
+
* Michael Mottola
|
36
|
+
|
37
|
+
### How to Contribute
|
38
|
+
|
39
|
+
This project is in active development. We are using it in real world projects; some parts work well, and others need more work. In other words; test it before using it.
|
40
|
+
|
41
|
+
We released it hoping that others would find it useful. We encourage you to fork the project and improve on it. We would be most gracious if you send a pull request with your modifications. We will include you in the list of contributors unless you request to not be listed.
|
42
|
+
|
43
|
+
The source code for this project is here: https://github.com/llwebsol/OmgValidators.
|
44
|
+
|
45
|
+
### License
|
46
|
+
|
47
|
+
Copyright (c) 2011-2012 Nickolas Kenyeres, Michael Mottola.
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
50
|
+
|
51
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
52
|
+
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,205 @@
|
|
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: OmgValidator::Validators::AlphaDashValidator
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.4
|
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)</a> »
|
37
|
+
<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
|
+
»
|
39
|
+
<span class="title">AlphaDashValidator</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: OmgValidator::Validators::AlphaDashValidator
|
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">ActiveModel::EachValidator</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">ActiveModel::EachValidator</li>
|
75
|
+
|
76
|
+
<li class="next">OmgValidator::Validators::AlphaDashValidator</li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
80
|
+
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">lib/omg_validator/validators/alpha_dash_validator.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
96
|
+
|
97
|
+
<h2>Overview</h2><div class="docstring">
|
98
|
+
<div class="discussion">
|
99
|
+
<p>
|
100
|
+
Checks whether input only contains alpha-numberic characters and dashes
|
101
|
+
</p>
|
102
|
+
<p>
|
103
|
+
validates :perma_link, alpha_dash: true
|
104
|
+
</p>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
<div class="tags">
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<h2>
|
121
|
+
Instance Method Summary
|
122
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
123
|
+
</h2>
|
124
|
+
|
125
|
+
<ul class="summary">
|
126
|
+
|
127
|
+
<li class="public ">
|
128
|
+
<span class="summary_signature">
|
129
|
+
|
130
|
+
<a href="#validate_each-instance_method" title="#validate_each (instance method)">- (Object) <strong>validate_each</strong>(record, attribute, value) </a>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
144
|
+
|
145
|
+
</li>
|
146
|
+
|
147
|
+
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<div id="instance_method_details" class="method_details_list">
|
155
|
+
<h2>Instance Method Details</h2>
|
156
|
+
|
157
|
+
|
158
|
+
<div class="method_details first">
|
159
|
+
<p class="signature first" id="validate_each-instance_method">
|
160
|
+
|
161
|
+
- (<tt>Object</tt>) <strong>validate_each</strong>(record, attribute, value)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</p><table class="source_code">
|
166
|
+
<tr>
|
167
|
+
<td>
|
168
|
+
<pre class="lines">
|
169
|
+
|
170
|
+
|
171
|
+
7
|
172
|
+
8
|
173
|
+
9
|
174
|
+
10
|
175
|
+
11
|
176
|
+
12
|
177
|
+
13</pre>
|
178
|
+
</td>
|
179
|
+
<td>
|
180
|
+
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/alpha_dash_validator.rb', line 7</span>
|
181
|
+
|
182
|
+
<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>
|
183
|
+
<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_nil?'>nil?</span>
|
184
|
+
<span class='id identifier rubyid_reg'>reg</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([-a-z0-9_-])+$</span><span class='regexp_end'>/i</span></span>
|
185
|
+
<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>
|
186
|
+
<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 only alpha-numeric characters and dashes</span><span class='tstring_end'>"</span></span>
|
187
|
+
<span class='kw'>end</span>
|
188
|
+
<span class='kw'>end</span></pre>
|
189
|
+
</td>
|
190
|
+
</tr>
|
191
|
+
</table>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="footer">
|
199
|
+
Generated on Fri Mar 30 10:49:14 2012 by
|
200
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
201
|
+
0.7.4 (ruby-1.9.2).
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</body>
|
205
|
+
</html>
|
@@ -0,0 +1,205 @@
|
|
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: OmgValidator::Validators::AlphaNumericValidator
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.4
|
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)</a> »
|
37
|
+
<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
|
+
»
|
39
|
+
<span class="title">AlphaNumericValidator</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: OmgValidator::Validators::AlphaNumericValidator
|
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">ActiveModel::EachValidator</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">ActiveModel::EachValidator</li>
|
75
|
+
|
76
|
+
<li class="next">OmgValidator::Validators::AlphaNumericValidator</li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
80
|
+
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">lib/omg_validator/validators/alpha_numeric_validator.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
96
|
+
|
97
|
+
<h2>Overview</h2><div class="docstring">
|
98
|
+
<div class="discussion">
|
99
|
+
<p>
|
100
|
+
Checks whether input only contains alpha-numberic characters
|
101
|
+
</p>
|
102
|
+
<p>
|
103
|
+
validates :title, alpha_numberic: true
|
104
|
+
</p>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
<div class="tags">
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<h2>
|
121
|
+
Instance Method Summary
|
122
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
123
|
+
</h2>
|
124
|
+
|
125
|
+
<ul class="summary">
|
126
|
+
|
127
|
+
<li class="public ">
|
128
|
+
<span class="summary_signature">
|
129
|
+
|
130
|
+
<a href="#validate_each-instance_method" title="#validate_each (instance method)">- (Object) <strong>validate_each</strong>(record, attribute, value) </a>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
144
|
+
|
145
|
+
</li>
|
146
|
+
|
147
|
+
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<div id="instance_method_details" class="method_details_list">
|
155
|
+
<h2>Instance Method Details</h2>
|
156
|
+
|
157
|
+
|
158
|
+
<div class="method_details first">
|
159
|
+
<p class="signature first" id="validate_each-instance_method">
|
160
|
+
|
161
|
+
- (<tt>Object</tt>) <strong>validate_each</strong>(record, attribute, value)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</p><table class="source_code">
|
166
|
+
<tr>
|
167
|
+
<td>
|
168
|
+
<pre class="lines">
|
169
|
+
|
170
|
+
|
171
|
+
7
|
172
|
+
8
|
173
|
+
9
|
174
|
+
10
|
175
|
+
11
|
176
|
+
12
|
177
|
+
13</pre>
|
178
|
+
</td>
|
179
|
+
<td>
|
180
|
+
<pre class="code"><span class="info file"># File 'lib/omg_validator/validators/alpha_numeric_validator.rb', line 7</span>
|
181
|
+
|
182
|
+
<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>
|
183
|
+
<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_nil?'>nil?</span>
|
184
|
+
<span class='id identifier rubyid_reg'>reg</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([a-z0-9])+$</span><span class='regexp_end'>/i</span></span>
|
185
|
+
<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>
|
186
|
+
<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 only alpha-numeric characters</span><span class='tstring_end'>"</span></span>
|
187
|
+
<span class='kw'>end</span>
|
188
|
+
<span class='kw'>end</span></pre>
|
189
|
+
</td>
|
190
|
+
</tr>
|
191
|
+
</table>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="footer">
|
199
|
+
Generated on Fri Mar 30 10:49:14 2012 by
|
200
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
201
|
+
0.7.4 (ruby-1.9.2).
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</body>
|
205
|
+
</html>
|