print_primes_table 0.0.2
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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +3 -0
- data/.yardoc/checksums +10 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/Rakefile +2 -0
- data/bin/print_primes_table +10 -0
- data/doc/PrintPrimesTable.html +146 -0
- data/doc/PrintPrimesTable/Client.html +368 -0
- data/doc/PrintPrimesTable/Options.html +142 -0
- data/doc/PrintPrimesTable/Options/DefaultOption.html +247 -0
- data/doc/PrintPrimesTable/Options/HelpOption.html +311 -0
- data/doc/PrintPrimesTable/Options/OnlyPrimesOption.html +289 -0
- data/doc/PrintPrimesTable/Primes.html +496 -0
- data/doc/PrintPrimesTable/Validators.html +142 -0
- data/doc/PrintPrimesTable/Validators/DefaultValidator.html +284 -0
- data/doc/PrintPrimesTable/Validators/ErrorMessage.html +405 -0
- data/doc/PrintPrimesTable/Validators/HelpValidator.html +285 -0
- data/doc/_index.html +228 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +122 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +122 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +135 -0
- data/doc/top-level-namespace.html +131 -0
- data/features/command_print_primes_table.feature +57 -0
- data/features/help_option.feature +24 -0
- data/features/support/env.rb +2 -0
- data/features/validate_arguments.feature +14 -0
- data/lib/print_primes_table.rb +4 -0
- data/lib/print_primes_table/client.rb +40 -0
- data/lib/print_primes_table/options/default_option.rb +28 -0
- data/lib/print_primes_table/options/help_option.rb +47 -0
- data/lib/print_primes_table/options/only_primes_option.rb +29 -0
- data/lib/print_primes_table/primes.rb +52 -0
- data/lib/print_primes_table/validators/default_validator.rb +39 -0
- data/lib/print_primes_table/validators/error_message.rb +31 -0
- data/lib/print_primes_table/validators/help_validator.rb +28 -0
- data/lib/print_primes_table/version.rb +10 -0
- data/print_primes_table.gemspec +29 -0
- metadata +132 -0
@@ -0,0 +1,142 @@
|
|
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: PrintPrimesTable::Validators
|
8
|
+
|
9
|
+
— 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#!PrintPrimesTable/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> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../PrintPrimesTable.html" title="PrintPrimesTable (module)">PrintPrimesTable</a></span></span>
|
36
|
+
»
|
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: PrintPrimesTable::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/print_primes_table/validators/default_validator.rb<span class="defines">,<br />
|
83
|
+
lib/print_primes_table/validators/error_message.rb,<br /> lib/print_primes_table/validators/help_validator.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
90
|
+
<div class="discussion">
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
<p class="tag_title">Author:</p>
|
98
|
+
<ul class="author">
|
99
|
+
|
100
|
+
<li>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<div class='inline'>
|
107
|
+
<p>Diego Hernán Piccinini Lagos</p>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</li>
|
111
|
+
|
112
|
+
</ul>
|
113
|
+
|
114
|
+
</div><h2>Defined Under Namespace</h2>
|
115
|
+
<p class="children">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Validators/DefaultValidator.html" title="PrintPrimesTable::Validators::DefaultValidator (class)">DefaultValidator</a></span>, <span class='object_link'><a href="Validators/ErrorMessage.html" title="PrintPrimesTable::Validators::ErrorMessage (class)">ErrorMessage</a></span>, <span class='object_link'><a href="Validators/HelpValidator.html" title="PrintPrimesTable::Validators::HelpValidator (class)">HelpValidator</a></span>
|
121
|
+
|
122
|
+
|
123
|
+
</p>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div id="footer">
|
136
|
+
Generated on Thu Apr 9 11:19:34 2015 by
|
137
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
138
|
+
0.8.7.6 (ruby-2.0.0).
|
139
|
+
</div>
|
140
|
+
|
141
|
+
</body>
|
142
|
+
</html>
|
@@ -0,0 +1,284 @@
|
|
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: PrintPrimesTable::Validators::DefaultValidator
|
8
|
+
|
9
|
+
— 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#!PrintPrimesTable/Validators/DefaultValidator.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 (D)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../PrintPrimesTable.html" title="PrintPrimesTable (module)">PrintPrimesTable</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="PrintPrimesTable::Validators (module)">Validators</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">DefaultValidator</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: PrintPrimesTable::Validators::DefaultValidator
|
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">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">PrintPrimesTable::Validators::DefaultValidator</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/print_primes_table/validators/default_validator.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Class Method Summary
|
112
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#validate-class_method" title="validate (class method)">+ (Symbol | String) <strong>validate</strong>(args) </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'>
|
135
|
+
<p>validate the args before a method to return a message to the user.</p>
|
136
|
+
</div></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
</ul>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<div id="class_method_details" class="method_details_list">
|
147
|
+
<h2>Class Method Details</h2>
|
148
|
+
|
149
|
+
|
150
|
+
<div class="method_details first">
|
151
|
+
<h3 class="signature first" id="validate-class_method">
|
152
|
+
|
153
|
+
+ (<tt>Symbol | String</tt>) <strong>validate</strong>(args)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
</h3><div class="docstring">
|
160
|
+
<div class="discussion">
|
161
|
+
|
162
|
+
<p>validate the args before a method to return a message to the user</p>
|
163
|
+
|
164
|
+
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
<div class="tags">
|
168
|
+
<p class="tag_title">Parameters:</p>
|
169
|
+
<ul class="param">
|
170
|
+
|
171
|
+
<li>
|
172
|
+
|
173
|
+
<span class='name'>args</span>
|
174
|
+
|
175
|
+
|
176
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
—
|
181
|
+
<div class='inline'>
|
182
|
+
<p>in this case is valid 1 argument integer</p>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
</li>
|
186
|
+
|
187
|
+
</ul>
|
188
|
+
|
189
|
+
<p class="tag_title">Returns:</p>
|
190
|
+
<ul class="return">
|
191
|
+
|
192
|
+
<li>
|
193
|
+
|
194
|
+
|
195
|
+
<span class='type'>(<tt>Symbol | String</tt>)</span>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
—
|
200
|
+
<div class='inline'>
|
201
|
+
<p>:valid or an Error Message</p>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
</ul>
|
207
|
+
|
208
|
+
</div><table class="source_code">
|
209
|
+
<tr>
|
210
|
+
<td>
|
211
|
+
<pre class="lines">
|
212
|
+
|
213
|
+
|
214
|
+
11
|
215
|
+
12
|
216
|
+
13
|
217
|
+
14
|
218
|
+
15
|
219
|
+
16
|
220
|
+
17
|
221
|
+
18
|
222
|
+
19
|
223
|
+
20
|
224
|
+
21
|
225
|
+
22
|
226
|
+
23
|
227
|
+
24
|
228
|
+
25
|
229
|
+
26
|
230
|
+
27
|
231
|
+
28
|
232
|
+
29
|
233
|
+
30
|
234
|
+
31
|
235
|
+
32
|
236
|
+
33
|
237
|
+
34
|
238
|
+
35</pre>
|
239
|
+
</td>
|
240
|
+
<td>
|
241
|
+
<pre class="code"><span class="info file"># File 'lib/print_primes_table/validators/default_validator.rb', line 11</span>
|
242
|
+
|
243
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
244
|
+
<span class='kw'>begin</span>
|
245
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
246
|
+
<span class='const'>ErrorMessage</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:command_wrong_arguments</span><span class='comma'>,</span>
|
247
|
+
<span class='lbrace'>{</span><span class='symbol'>:max</span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:argument_num</span> <span class='op'>=></span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='rbrace'>}</span>
|
248
|
+
<span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_show_content'>show_content</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>></span> <span class='int'>1</span>
|
249
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>></span> <span class='int'>0</span>
|
250
|
+
|
251
|
+
<span class='kw'>begin</span>
|
252
|
+
<span class='id identifier rubyid_total'>total</span> <span class='op'>=</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
253
|
+
<span class='kw'>rescue</span>
|
254
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
255
|
+
<span class='const'>ErrorMessage</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:command_wrong_type_arguments</span><span class='comma'>,</span>
|
256
|
+
<span class='lbrace'>{</span> <span class='symbol'>:argument</span> <span class='op'>=></span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_show_content'>show_content</span><span class='rparen'>)</span>
|
257
|
+
<span class='kw'>end</span>
|
258
|
+
|
259
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>RangeError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
260
|
+
<span class='const'>ErrorMessage</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:less_than_min</span><span class='comma'>,</span>
|
261
|
+
<span class='lbrace'>{</span> <span class='symbol'>:min</span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:argument</span> <span class='op'>=></span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_show_content'>show_content</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_total'>total</span> <span class='op'><</span> <span class='int'>1</span>
|
262
|
+
<span class='kw'>end</span>
|
263
|
+
<span class='symbol'>:valid</span>
|
264
|
+
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_err'>err</span>
|
265
|
+
<span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
266
|
+
<span class='kw'>end</span>
|
267
|
+
<span class='kw'>end</span></pre>
|
268
|
+
</td>
|
269
|
+
</tr>
|
270
|
+
</table>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div id="footer">
|
278
|
+
Generated on Thu Apr 9 11:19:35 2015 by
|
279
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
280
|
+
0.8.7.6 (ruby-2.0.0).
|
281
|
+
</div>
|
282
|
+
|
283
|
+
</body>
|
284
|
+
</html>
|
@@ -0,0 +1,405 @@
|
|
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: PrintPrimesTable::Validators::ErrorMessage
|
8
|
+
|
9
|
+
— 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#!PrintPrimesTable/Validators/ErrorMessage.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 (E)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../PrintPrimesTable.html" title="PrintPrimesTable (module)">PrintPrimesTable</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="PrintPrimesTable::Validators (module)">Validators</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">ErrorMessage</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: PrintPrimesTable::Validators::ErrorMessage
|
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">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">PrintPrimesTable::Validators::ErrorMessage</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/print_primes_table/validators/error_message.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>An intance contains te error_type and a message to the user</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
<p class="tag_title">Author:</p>
|
113
|
+
<ul class="author">
|
114
|
+
|
115
|
+
<li>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div class='inline'>
|
122
|
+
<p>Diego Hernán Piccinini Lagos</p>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</li>
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
<h2>Constant Summary</h2>
|
131
|
+
|
132
|
+
<dl class="constants">
|
133
|
+
|
134
|
+
<dt id="MESSAGES-constant" class="">MESSAGES =
|
135
|
+
|
136
|
+
</dt>
|
137
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
138
|
+
|
139
|
+
<span class='symbol'>:command_wrong_arguments</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>the program allowed %{max} argument maximun, you typed %{argument_num}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
140
|
+
<span class='symbol'>:command_wrong_type_arguments</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sorry, %{argument} is not an integer</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
141
|
+
<span class='symbol'>:less_than_min</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The minimun quantity is %{min}, so %{argument} is not valid</span><span class='tstring_end'>"</span></span>
|
142
|
+
<span class='rbrace'>}</span></pre></dd>
|
143
|
+
|
144
|
+
</dl>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<h2>
|
155
|
+
Instance Method Summary
|
156
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
157
|
+
</h2>
|
158
|
+
|
159
|
+
<ul class="summary">
|
160
|
+
|
161
|
+
<li class="public ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (ErrorMessage) <strong>initialize</strong>(error_type = :invalid, args = {}, content = nil) </a>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</span>
|
169
|
+
|
170
|
+
|
171
|
+
<span class="note title constructor">constructor</span>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'>
|
181
|
+
<p>initialize the message.</p>
|
182
|
+
</div></span>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
<li class="public ">
|
188
|
+
<span class="summary_signature">
|
189
|
+
|
190
|
+
<a href="#show_content-instance_method" title="#show_content (instance method)">- (Object) <strong>show_content</strong> </a>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
</span>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
<span class="summary_desc"><div class='inline'>
|
205
|
+
<p>Text message [String] it could contain arguments.</p>
|
206
|
+
</div></span>
|
207
|
+
|
208
|
+
</li>
|
209
|
+
|
210
|
+
|
211
|
+
</ul>
|
212
|
+
|
213
|
+
|
214
|
+
<div id="constructor_details" class="method_details_list">
|
215
|
+
<h2>Constructor Details</h2>
|
216
|
+
|
217
|
+
<div class="method_details first">
|
218
|
+
<h3 class="signature first" id="initialize-instance_method">
|
219
|
+
|
220
|
+
- (<tt><span class='object_link'><a href="" title="PrintPrimesTable::Validators::ErrorMessage (class)">ErrorMessage</a></span></tt>) <strong>initialize</strong>(error_type = :invalid, args = {}, content = nil)
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
</h3><div class="docstring">
|
227
|
+
<div class="discussion">
|
228
|
+
|
229
|
+
<p>initialize the message</p>
|
230
|
+
|
231
|
+
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
<div class="tags">
|
235
|
+
<p class="tag_title">Parameters:</p>
|
236
|
+
<ul class="param">
|
237
|
+
|
238
|
+
<li>
|
239
|
+
|
240
|
+
<span class='name'>content</span>
|
241
|
+
|
242
|
+
|
243
|
+
<span class='type'>(<tt>String</tt>)</span>
|
244
|
+
|
245
|
+
|
246
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
247
|
+
|
248
|
+
|
249
|
+
—
|
250
|
+
<div class='inline'>
|
251
|
+
<p>text message to the user</p>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
<li>
|
257
|
+
|
258
|
+
<span class='name'>error_type</span>
|
259
|
+
|
260
|
+
|
261
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
262
|
+
|
263
|
+
|
264
|
+
<em class="default">(defaults to: <tt>:invalid</tt>)</em>
|
265
|
+
|
266
|
+
|
267
|
+
—
|
268
|
+
<div class='inline'>
|
269
|
+
<p>to qualifies the error</p>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
<li>
|
275
|
+
|
276
|
+
<span class='name'>args</span>
|
277
|
+
|
278
|
+
|
279
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
280
|
+
|
281
|
+
|
282
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
283
|
+
|
284
|
+
|
285
|
+
—
|
286
|
+
<div class='inline'>
|
287
|
+
<p>to include params in the response</p>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
</li>
|
291
|
+
|
292
|
+
</ul>
|
293
|
+
|
294
|
+
|
295
|
+
</div><table class="source_code">
|
296
|
+
<tr>
|
297
|
+
<td>
|
298
|
+
<pre class="lines">
|
299
|
+
|
300
|
+
|
301
|
+
16
|
302
|
+
17
|
303
|
+
18
|
304
|
+
19
|
305
|
+
20
|
306
|
+
21
|
307
|
+
22
|
308
|
+
23
|
309
|
+
24</pre>
|
310
|
+
</td>
|
311
|
+
<td>
|
312
|
+
<pre class="code"><span class="info file"># File 'lib/print_primes_table/validators/error_message.rb', line 16</span>
|
313
|
+
|
314
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_error_type'>error_type</span> <span class='op'>=</span> <span class='symbol'>:invalid</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
315
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_content'>content</span>
|
316
|
+
<span class='ivar'>@content</span><span class='op'>=</span><span class='const'>MESSAGES</span><span class='lbracket'>[</span><span class='id identifier rubyid_error_type'>error_type</span><span class='rbracket'>]</span>
|
317
|
+
<span class='kw'>else</span>
|
318
|
+
<span class='ivar'>@content</span> <span class='op'>=</span> <span class='id identifier rubyid_content'>content</span>
|
319
|
+
<span class='kw'>end</span>
|
320
|
+
<span class='ivar'>@error_type</span> <span class='op'>=</span> <span class='id identifier rubyid_error_type'>error_type</span>
|
321
|
+
<span class='ivar'>@args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span>
|
322
|
+
<span class='kw'>end</span></pre>
|
323
|
+
</td>
|
324
|
+
</tr>
|
325
|
+
</table>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
</div>
|
329
|
+
|
330
|
+
|
331
|
+
<div id="instance_method_details" class="method_details_list">
|
332
|
+
<h2>Instance Method Details</h2>
|
333
|
+
|
334
|
+
|
335
|
+
<div class="method_details first">
|
336
|
+
<h3 class="signature first" id="show_content-instance_method">
|
337
|
+
|
338
|
+
- (<tt>Object</tt>) <strong>show_content</strong>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
</h3><div class="docstring">
|
345
|
+
<div class="discussion">
|
346
|
+
|
347
|
+
<p>Returns text message [String] it could contain arguments</p>
|
348
|
+
|
349
|
+
|
350
|
+
</div>
|
351
|
+
</div>
|
352
|
+
<div class="tags">
|
353
|
+
|
354
|
+
<p class="tag_title">Returns:</p>
|
355
|
+
<ul class="return">
|
356
|
+
|
357
|
+
<li>
|
358
|
+
|
359
|
+
|
360
|
+
<span class='type'></span>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
<div class='inline'>
|
366
|
+
<p>text message [String] it could contain arguments</p>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
</li>
|
370
|
+
|
371
|
+
</ul>
|
372
|
+
|
373
|
+
</div><table class="source_code">
|
374
|
+
<tr>
|
375
|
+
<td>
|
376
|
+
<pre class="lines">
|
377
|
+
|
378
|
+
|
379
|
+
26
|
380
|
+
27
|
381
|
+
28</pre>
|
382
|
+
</td>
|
383
|
+
<td>
|
384
|
+
<pre class="code"><span class="info file"># File 'lib/print_primes_table/validators/error_message.rb', line 26</span>
|
385
|
+
|
386
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_show_content'>show_content</span>
|
387
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='ivar'>@content</span> <span class='op'>%</span> <span class='ivar'>@args</span>
|
388
|
+
<span class='kw'>end</span></pre>
|
389
|
+
</td>
|
390
|
+
</tr>
|
391
|
+
</table>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
</div>
|
395
|
+
|
396
|
+
</div>
|
397
|
+
|
398
|
+
<div id="footer">
|
399
|
+
Generated on Thu Apr 9 11:19:34 2015 by
|
400
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
401
|
+
0.8.7.6 (ruby-2.0.0).
|
402
|
+
</div>
|
403
|
+
|
404
|
+
</body>
|
405
|
+
</html>
|