apes 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rubocop.yml +82 -0
  4. data/.travis-gemfile +15 -0
  5. data/.travis.yml +15 -0
  6. data/.yardopts +1 -0
  7. data/CHANGELOG.md +3 -0
  8. data/Gemfile +22 -0
  9. data/README.md +177 -0
  10. data/Rakefile +44 -0
  11. data/apes.gemspec +34 -0
  12. data/doc/Apes.html +130 -0
  13. data/doc/Apes/Concerns.html +127 -0
  14. data/doc/Apes/Concerns/Errors.html +1089 -0
  15. data/doc/Apes/Concerns/Pagination.html +636 -0
  16. data/doc/Apes/Concerns/Request.html +766 -0
  17. data/doc/Apes/Concerns/Response.html +940 -0
  18. data/doc/Apes/Controller.html +1100 -0
  19. data/doc/Apes/Errors.html +125 -0
  20. data/doc/Apes/Errors/AuthenticationError.html +133 -0
  21. data/doc/Apes/Errors/BadRequestError.html +157 -0
  22. data/doc/Apes/Errors/BaseError.html +320 -0
  23. data/doc/Apes/Errors/InvalidDataError.html +157 -0
  24. data/doc/Apes/Errors/MissingDataError.html +157 -0
  25. data/doc/Apes/Model.html +378 -0
  26. data/doc/Apes/PaginationCursor.html +2138 -0
  27. data/doc/Apes/RuntimeConfiguration.html +909 -0
  28. data/doc/Apes/Serializers.html +125 -0
  29. data/doc/Apes/Serializers/JSON.html +389 -0
  30. data/doc/Apes/Serializers/JWT.html +452 -0
  31. data/doc/Apes/Serializers/List.html +347 -0
  32. data/doc/Apes/UrlsParser.html +1432 -0
  33. data/doc/Apes/Validators.html +125 -0
  34. data/doc/Apes/Validators/BaseValidator.html +278 -0
  35. data/doc/Apes/Validators/BooleanValidator.html +494 -0
  36. data/doc/Apes/Validators/EmailValidator.html +350 -0
  37. data/doc/Apes/Validators/PhoneValidator.html +375 -0
  38. data/doc/Apes/Validators/ReferenceValidator.html +372 -0
  39. data/doc/Apes/Validators/TimestampValidator.html +640 -0
  40. data/doc/Apes/Validators/UuidValidator.html +372 -0
  41. data/doc/Apes/Validators/ZipCodeValidator.html +372 -0
  42. data/doc/Apes/Version.html +189 -0
  43. data/doc/ApplicationController.html +547 -0
  44. data/doc/Concerns.html +128 -0
  45. data/doc/Concerns/ErrorHandling.html +826 -0
  46. data/doc/Concerns/PaginationHandling.html +463 -0
  47. data/doc/Concerns/RequestHandling.html +512 -0
  48. data/doc/Concerns/ResponseHandling.html +579 -0
  49. data/doc/Errors.html +126 -0
  50. data/doc/Errors/AuthenticationError.html +123 -0
  51. data/doc/Errors/BadRequestError.html +147 -0
  52. data/doc/Errors/BaseError.html +289 -0
  53. data/doc/Errors/InvalidDataError.html +147 -0
  54. data/doc/Errors/MissingDataError.html +147 -0
  55. data/doc/Model.html +315 -0
  56. data/doc/PaginationCursor.html +764 -0
  57. data/doc/Serializers.html +126 -0
  58. data/doc/Serializers/JSON.html +253 -0
  59. data/doc/Serializers/JWT.html +253 -0
  60. data/doc/Serializers/List.html +245 -0
  61. data/doc/Validators.html +126 -0
  62. data/doc/Validators/BaseValidator.html +209 -0
  63. data/doc/Validators/BooleanValidator.html +391 -0
  64. data/doc/Validators/EmailValidator.html +298 -0
  65. data/doc/Validators/PhoneValidator.html +313 -0
  66. data/doc/Validators/ReferenceValidator.html +284 -0
  67. data/doc/Validators/TimestampValidator.html +476 -0
  68. data/doc/Validators/UuidValidator.html +310 -0
  69. data/doc/Validators/ZipCodeValidator.html +310 -0
  70. data/doc/_index.html +435 -0
  71. data/doc/class_list.html +58 -0
  72. data/doc/css/common.css +1 -0
  73. data/doc/css/full_list.css +57 -0
  74. data/doc/css/style.css +339 -0
  75. data/doc/file.README.html +252 -0
  76. data/doc/file_list.html +60 -0
  77. data/doc/frames.html +26 -0
  78. data/doc/index.html +252 -0
  79. data/doc/js/app.js +219 -0
  80. data/doc/js/full_list.js +181 -0
  81. data/doc/js/jquery.js +4 -0
  82. data/doc/method_list.html +615 -0
  83. data/doc/top-level-namespace.html +112 -0
  84. data/lib/apes.rb +40 -0
  85. data/lib/apes/concerns/errors.rb +111 -0
  86. data/lib/apes/concerns/pagination.rb +81 -0
  87. data/lib/apes/concerns/request.rb +237 -0
  88. data/lib/apes/concerns/response.rb +74 -0
  89. data/lib/apes/controller.rb +77 -0
  90. data/lib/apes/errors.rb +38 -0
  91. data/lib/apes/model.rb +94 -0
  92. data/lib/apes/pagination_cursor.rb +152 -0
  93. data/lib/apes/runtime_configuration.rb +80 -0
  94. data/lib/apes/serializers.rb +88 -0
  95. data/lib/apes/urls_parser.rb +233 -0
  96. data/lib/apes/validators.rb +234 -0
  97. data/lib/apes/version.rb +24 -0
  98. data/spec/apes/concerns/errors_spec.rb +141 -0
  99. data/spec/apes/concerns/pagination_spec.rb +114 -0
  100. data/spec/apes/concerns/request_spec.rb +244 -0
  101. data/spec/apes/concerns/response_spec.rb +79 -0
  102. data/spec/apes/controller_spec.rb +54 -0
  103. data/spec/apes/errors_spec.rb +14 -0
  104. data/spec/apes/models_spec.rb +148 -0
  105. data/spec/apes/pagination_cursor_spec.rb +113 -0
  106. data/spec/apes/runtime_configuration_spec.rb +100 -0
  107. data/spec/apes/serializers_spec.rb +70 -0
  108. data/spec/apes/urls_parser_spec.rb +150 -0
  109. data/spec/apes/validators_spec.rb +237 -0
  110. data/spec/spec_helper.rb +30 -0
  111. data/views/_included.json.jbuilder +9 -0
  112. data/views/_pagination.json.jbuilder +9 -0
  113. data/views/collection.json.jbuilder +4 -0
  114. data/views/errors/400.json.jbuilder +9 -0
  115. data/views/errors/403.json.jbuilder +7 -0
  116. data/views/errors/404.json.jbuilder +6 -0
  117. data/views/errors/422.json.jbuilder +19 -0
  118. data/views/errors/500.json.jbuilder +12 -0
  119. data/views/errors/501.json.jbuilder +7 -0
  120. data/views/layouts/general.json.jbuilder +36 -0
  121. data/views/object.json.jbuilder +4 -0
  122. metadata +262 -0
@@ -0,0 +1,125 @@
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: Apes::Validators
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!Apes/Validators.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (V)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Apes.html" title="Apes (module)">Apes</a></span></span>
36
+ &raquo;
37
+ <span class="title">Validators</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Apes::Validators
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/apes/validators.rb</dd>
83
+
84
+ </dl>
85
+ <div class="clear"></div>
86
+
87
+ <h2>Overview</h2><div class="docstring">
88
+ <div class="discussion">
89
+ <p>A useful set of validators.</p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+
97
+ </div><h2>Defined Under Namespace</h2>
98
+ <p class="children">
99
+
100
+
101
+
102
+
103
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Validators/BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span>, <span class='object_link'><a href="Validators/BooleanValidator.html" title="Apes::Validators::BooleanValidator (class)">BooleanValidator</a></span>, <span class='object_link'><a href="Validators/EmailValidator.html" title="Apes::Validators::EmailValidator (class)">EmailValidator</a></span>, <span class='object_link'><a href="Validators/PhoneValidator.html" title="Apes::Validators::PhoneValidator (class)">PhoneValidator</a></span>, <span class='object_link'><a href="Validators/ReferenceValidator.html" title="Apes::Validators::ReferenceValidator (class)">ReferenceValidator</a></span>, <span class='object_link'><a href="Validators/TimestampValidator.html" title="Apes::Validators::TimestampValidator (class)">TimestampValidator</a></span>, <span class='object_link'><a href="Validators/UuidValidator.html" title="Apes::Validators::UuidValidator (class)">UuidValidator</a></span>, <span class='object_link'><a href="Validators/ZipCodeValidator.html" title="Apes::Validators::ZipCodeValidator (class)">ZipCodeValidator</a></span>
104
+
105
+
106
+ </p>
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ </div>
117
+
118
+ <div id="footer">
119
+ Generated on Sat Jun 4 12:41:53 2016 by
120
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
+ 0.8.7.6 (ruby-2.3.0).
122
+ </div>
123
+
124
+ </body>
125
+ </html>
@@ -0,0 +1,278 @@
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: Apes::Validators::BaseValidator
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!Apes/Validators/BaseValidator.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (B)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Apes.html" title="Apes (module)">Apes</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Validators.html" title="Apes::Validators (module)">Validators</a></span></span>
36
+ &raquo;
37
+ <span class="title">BaseValidator</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Apes::Validators::BaseValidator
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">ActiveModel::EachValidator</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ActiveModel::EachValidator</li>
82
+
83
+ <li class="next">Apes::Validators::BaseValidator</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/apes/validators.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>The base validator.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div><div id="subclasses">
115
+ <h2>Direct Known Subclasses</h2>
116
+ <p class="children"><span class='object_link'><a href="BooleanValidator.html" title="Apes::Validators::BooleanValidator (class)">BooleanValidator</a></span>, <span class='object_link'><a href="EmailValidator.html" title="Apes::Validators::EmailValidator (class)">EmailValidator</a></span>, <span class='object_link'><a href="PhoneValidator.html" title="Apes::Validators::PhoneValidator (class)">PhoneValidator</a></span>, <span class='object_link'><a href="ReferenceValidator.html" title="Apes::Validators::ReferenceValidator (class)">ReferenceValidator</a></span>, <span class='object_link'><a href="TimestampValidator.html" title="Apes::Validators::TimestampValidator (class)">TimestampValidator</a></span>, <span class='object_link'><a href="UuidValidator.html" title="Apes::Validators::UuidValidator (class)">UuidValidator</a></span>, <span class='object_link'><a href="ZipCodeValidator.html" title="Apes::Validators::ZipCodeValidator (class)">ZipCodeValidator</a></span></p>
117
+ </div>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <h2>
127
+ Instance Method Summary
128
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
129
+ </h2>
130
+
131
+ <ul class="summary">
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#validate_each-instance_method" title="#validate_each (instance method)">- (Object) <strong>validate_each</strong>(model, attribute, value) </a>
137
+
138
+
139
+
140
+ </span>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'><p>Perform validation on a attribute of a model.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ </ul>
157
+
158
+
159
+
160
+
161
+
162
+ <div id="instance_method_details" class="method_details_list">
163
+ <h2>Instance Method Details</h2>
164
+
165
+
166
+ <div class="method_details first">
167
+ <h3 class="signature first" id="validate_each-instance_method">
168
+
169
+ - (<tt>Object</tt>) <strong>validate_each</strong>(model, attribute, value)
170
+
171
+
172
+
173
+
174
+
175
+ </h3><div class="docstring">
176
+ <div class="discussion">
177
+ <p>Perform validation on a attribute of a model.</p>
178
+
179
+
180
+ </div>
181
+ </div>
182
+ <div class="tags">
183
+ <p class="tag_title">Parameters:</p>
184
+ <ul class="param">
185
+
186
+ <li>
187
+
188
+ <span class='name'>model</span>
189
+
190
+
191
+ <span class='type'>(<tt>Object</tt>)</span>
192
+
193
+
194
+
195
+ &mdash;
196
+ <div class='inline'><p>The object to validate.</p>
197
+ </div>
198
+
199
+ </li>
200
+
201
+ <li>
202
+
203
+ <span class='name'>attribute</span>
204
+
205
+
206
+ <span class='type'>(<tt>String|Symbol</tt>)</span>
207
+
208
+
209
+
210
+ &mdash;
211
+ <div class='inline'><p>The attribute to validate.</p>
212
+ </div>
213
+
214
+ </li>
215
+
216
+ <li>
217
+
218
+ <span class='name'>value</span>
219
+
220
+
221
+ <span class='type'>(<tt>Object</tt>)</span>
222
+
223
+
224
+
225
+ &mdash;
226
+ <div class='inline'><p>The value of the attribute.</p>
227
+ </div>
228
+
229
+ </li>
230
+
231
+ </ul>
232
+
233
+
234
+ </div><table class="source_code">
235
+ <tr>
236
+ <td>
237
+ <pre class="lines">
238
+
239
+
240
+ 16
241
+ 17
242
+ 18
243
+ 19
244
+ 20
245
+ 21
246
+ 22
247
+ 23
248
+ 24</pre>
249
+ </td>
250
+ <td>
251
+ <pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 16</span>
252
+
253
+ <span class='kw'>def</span> <span class='id identifier rubyid_validate_each'>validate_each</span><span class='lparen'>(</span><span class='id identifier rubyid_model'>model</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>
254
+ <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='id identifier rubyid_check_valid?'>check_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
255
+ <span class='kw'>return</span> <span class='id identifier rubyid_checked'>checked</span> <span class='kw'>if</span> <span class='id identifier rubyid_checked'>checked</span>
256
+
257
+ <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:message</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default_message</span><span class='rbracket'>]</span>
258
+ <span class='id identifier rubyid_destination'>destination</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:additional</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_model'>model</span><span class='period'>.</span><span class='id identifier rubyid_additional_errors'>additional_errors</span> <span class='op'>:</span> <span class='id identifier rubyid_model'>model</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span>
259
+ <span class='id identifier rubyid_destination'>destination</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_message'>message</span>
260
+ <span class='kw'>nil</span>
261
+ <span class='kw'>end</span></pre>
262
+ </td>
263
+ </tr>
264
+ </table>
265
+ </div>
266
+
267
+ </div>
268
+
269
+ </div>
270
+
271
+ <div id="footer">
272
+ Generated on Sat Jun 4 12:41:53 2016 by
273
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
274
+ 0.8.7.6 (ruby-2.3.0).
275
+ </div>
276
+
277
+ </body>
278
+ </html>
@@ -0,0 +1,494 @@
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: Apes::Validators::BooleanValidator
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!Apes/Validators/BooleanValidator.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (B)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Apes.html" title="Apes (module)">Apes</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Validators.html" title="Apes::Validators (module)">Validators</a></span></span>
36
+ &raquo;
37
+ <span class="title">BooleanValidator</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Apes::Validators::BooleanValidator
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName"><span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ActiveModel::EachValidator</li>
82
+
83
+ <li class="next"><span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></li>
84
+
85
+ <li class="next">Apes::Validators::BooleanValidator</li>
86
+
87
+ </ul>
88
+ <a href="#" class="inheritanceTree">show all</a>
89
+
90
+ </dd>
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dt class="r2 last">Defined in:</dt>
101
+ <dd class="r2 last">lib/apes/validators.rb</dd>
102
+
103
+ </dl>
104
+ <div class="clear"></div>
105
+
106
+ <h2>Overview</h2><div class="docstring">
107
+ <div class="discussion">
108
+ <p>Validates boolean values.</p>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+
116
+ </div>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <h2>
125
+ Class Method Summary
126
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
127
+ </h2>
128
+
129
+ <ul class="summary">
130
+
131
+ <li class="public ">
132
+ <span class="summary_signature">
133
+
134
+ <a href="#parse-class_method" title="parse (class method)">+ (Boolean|NilClass) <strong>parse</strong>(value, raise_errors: false) </a>
135
+
136
+
137
+
138
+ </span>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+ <span class="summary_desc"><div class='inline'><p>Parses a boolean value.</p>
149
+ </div></span>
150
+
151
+ </li>
152
+
153
+
154
+ </ul>
155
+
156
+ <h2>
157
+ Instance Method Summary
158
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
159
+ </h2>
160
+
161
+ <ul class="summary">
162
+
163
+ <li class="public ">
164
+ <span class="summary_signature">
165
+
166
+ <a href="#check_valid%3F-instance_method" title="#check_valid? (instance method)">- (Boolean) <strong>check_valid?</strong>(value) </a>
167
+
168
+
169
+
170
+ </span>
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="summary_desc"><div class='inline'><p>Checks if the value is valid for this validator.</p>
181
+ </div></span>
182
+
183
+ </li>
184
+
185
+
186
+ <li class="public ">
187
+ <span class="summary_signature">
188
+
189
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Apes::Validators::BooleanValidator) <strong>initialize</strong>(options) </a>
190
+
191
+
192
+
193
+ </span>
194
+
195
+
196
+ <span class="note title constructor">constructor</span>
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <span class="summary_desc"><div class='inline'><p>Creates a new validator.</p>
206
+ </div></span>
207
+
208
+ </li>
209
+
210
+
211
+ </ul>
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></h3>
224
+ <p class="inherited"><span class='object_link'><a href="BaseValidator.html#validate_each-instance_method" title="Apes::Validators::BaseValidator#validate_each (method)">#validate_each</a></span></p>
225
+
226
+ <div id="constructor_details" class="method_details_list">
227
+ <h2>Constructor Details</h2>
228
+
229
+ <div class="method_details first">
230
+ <h3 class="signature first" id="initialize-instance_method">
231
+
232
+ - (<tt><span class='object_link'><a href="" title="Apes::Validators::BooleanValidator (class)">Apes::Validators::BooleanValidator</a></span></tt>) <strong>initialize</strong>(options)
233
+
234
+
235
+
236
+
237
+
238
+ </h3><div class="docstring">
239
+ <div class="discussion">
240
+ <p>Creates a new validator.</p>
241
+
242
+
243
+ </div>
244
+ </div>
245
+ <div class="tags">
246
+ <p class="tag_title">Parameters:</p>
247
+ <ul class="param">
248
+
249
+ <li>
250
+
251
+ <span class='name'>options</span>
252
+
253
+
254
+ <span class='type'>(<tt>Hash</tt>)</span>
255
+
256
+
257
+
258
+ &mdash;
259
+ <div class='inline'><p>The options for the validations.</p>
260
+ </div>
261
+
262
+ </li>
263
+
264
+ </ul>
265
+
266
+
267
+ </div><table class="source_code">
268
+ <tr>
269
+ <td>
270
+ <pre class="lines">
271
+
272
+
273
+ 120
274
+ 121
275
+ 122</pre>
276
+ </td>
277
+ <td>
278
+ <pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 120</span>
279
+
280
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
281
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_reverse_merge'>reverse_merge</span><span class='lparen'>(</span><span class='label'>default_message:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>must be a valid truthy/falsey value</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
282
+ <span class='kw'>end</span></pre>
283
+ </td>
284
+ </tr>
285
+ </table>
286
+ </div>
287
+
288
+ </div>
289
+
290
+
291
+ <div id="class_method_details" class="method_details_list">
292
+ <h2>Class Method Details</h2>
293
+
294
+
295
+ <div class="method_details first">
296
+ <h3 class="signature first" id="parse-class_method">
297
+
298
+ + (<tt>Boolean|NilClass</tt>) <strong>parse</strong>(value, raise_errors: false)
299
+
300
+
301
+
302
+
303
+
304
+ </h3><div class="docstring">
305
+ <div class="discussion">
306
+ <p>Parses a boolean value.</p>
307
+
308
+
309
+ </div>
310
+ </div>
311
+ <div class="tags">
312
+ <p class="tag_title">Parameters:</p>
313
+ <ul class="param">
314
+
315
+ <li>
316
+
317
+ <span class='name'>value</span>
318
+
319
+
320
+ <span class='type'>(<tt>Object</tt>)</span>
321
+
322
+
323
+
324
+ &mdash;
325
+ <div class='inline'><p>The value to parse.</p>
326
+ </div>
327
+
328
+ </li>
329
+
330
+ <li>
331
+
332
+ <span class='name'>raise_errors</span>
333
+
334
+
335
+ <span class='type'>(<tt>Boolean</tt>)</span>
336
+
337
+
338
+
339
+ &mdash;
340
+ <div class='inline'><p>Whether to raise errors in case the value couldn’t be parsed.</p>
341
+ </div>
342
+
343
+ </li>
344
+
345
+ </ul>
346
+
347
+ <p class="tag_title">Returns:</p>
348
+ <ul class="return">
349
+
350
+ <li>
351
+
352
+
353
+ <span class='type'>(<tt>Boolean|NilClass</tt>)</span>
354
+
355
+
356
+
357
+ &mdash;
358
+ <div class='inline'><p>A boolean value if parsing succeded, <code>nil</code> otherwise.</p>
359
+ </div>
360
+
361
+ </li>
362
+
363
+ </ul>
364
+ <p class="tag_title">Raises:</p>
365
+ <ul class="raise">
366
+
367
+ <li>
368
+
369
+
370
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
371
+
372
+
373
+
374
+ </li>
375
+
376
+ </ul>
377
+
378
+ </div><table class="source_code">
379
+ <tr>
380
+ <td>
381
+ <pre class="lines">
382
+
383
+
384
+ 111
385
+ 112
386
+ 113
387
+ 114</pre>
388
+ </td>
389
+ <td>
390
+ <pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 111</span>
391
+
392
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='label'>raise_errors:</span> <span class='kw'>false</span><span class='rparen'>)</span>
393
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid boolean value \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot;.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_boolean?'>boolean?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_raise_errors'>raise_errors</span>
394
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span>
395
+ <span class='kw'>end</span></pre>
396
+ </td>
397
+ </tr>
398
+ </table>
399
+ </div>
400
+
401
+ </div>
402
+
403
+ <div id="instance_method_details" class="method_details_list">
404
+ <h2>Instance Method Details</h2>
405
+
406
+
407
+ <div class="method_details first">
408
+ <h3 class="signature first" id="check_valid?-instance_method">
409
+
410
+ - (<tt>Boolean</tt>) <strong>check_valid?</strong>(value)
411
+
412
+
413
+
414
+
415
+
416
+ </h3><div class="docstring">
417
+ <div class="discussion">
418
+ <p>Checks if the value is valid for this validator.</p>
419
+
420
+
421
+ </div>
422
+ </div>
423
+ <div class="tags">
424
+ <p class="tag_title">Parameters:</p>
425
+ <ul class="param">
426
+
427
+ <li>
428
+
429
+ <span class='name'>value</span>
430
+
431
+
432
+ <span class='type'>(<tt>Object</tt>)</span>
433
+
434
+
435
+
436
+ &mdash;
437
+ <div class='inline'><p>The value to validate.</p>
438
+ </div>
439
+
440
+ </li>
441
+
442
+ </ul>
443
+
444
+ <p class="tag_title">Returns:</p>
445
+ <ul class="return">
446
+
447
+ <li>
448
+
449
+
450
+ <span class='type'>(<tt>Boolean</tt>)</span>
451
+
452
+
453
+
454
+ &mdash;
455
+ <div class='inline'><p><code>true</code> if the value is valid, false otherwise.</p>
456
+ </div>
457
+
458
+ </li>
459
+
460
+ </ul>
461
+
462
+ </div><table class="source_code">
463
+ <tr>
464
+ <td>
465
+ <pre class="lines">
466
+
467
+
468
+ 128
469
+ 129
470
+ 130</pre>
471
+ </td>
472
+ <td>
473
+ <pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 128</span>
474
+
475
+ <span class='kw'>def</span> <span class='id identifier rubyid_check_valid?'>check_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
476
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_boolean?'>boolean?</span>
477
+ <span class='kw'>end</span></pre>
478
+ </td>
479
+ </tr>
480
+ </table>
481
+ </div>
482
+
483
+ </div>
484
+
485
+ </div>
486
+
487
+ <div id="footer">
488
+ Generated on Sat Jun 4 12:41:54 2016 by
489
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
490
+ 0.8.7.6 (ruby-2.3.0).
491
+ </div>
492
+
493
+ </body>
494
+ </html>