action_command 0.1.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.
- checksums.yaml +7 -0
- data/.codeclimate.yml +26 -0
- data/.gitignore +36 -0
- data/.rspec +2 -0
- data/.rubocop.yml +11 -0
- data/.travis.yml +21 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +112 -0
- data/Guardfile +75 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +18 -0
- data/action_command.gemspec +36 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/ActionCommand/Executable.html +625 -0
- data/doc/ActionCommand/InputOutput.html +876 -0
- data/doc/ActionCommand/Result.html +589 -0
- data/doc/ActionCommand.html +982 -0
- data/doc/_index.html +155 -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 +137 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +137 -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 +219 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/action_command/version.rb +4 -0
- data/lib/action_command.rb +277 -0
- metadata +264 -0
@@ -0,0 +1,876 @@
|
|
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: ActionCommand::InputOutput
|
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#!ActionCommand/InputOutput.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 (I)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../ActionCommand.html" title="ActionCommand (module)">ActionCommand</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">InputOutput</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: ActionCommand::InputOutput
|
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">ActionCommand::InputOutput</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/action_command.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>A static description of the input and output from a given command.
|
106
|
+
Although adding this adds a bunch of documentation and validation, it is
|
107
|
+
not required. If you don't want to specify your input and output, you
|
108
|
+
can just access the hash you passed into the command as @params</p>
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
<div class="tags">
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
<h2>Constant Summary</h2>
|
118
|
+
|
119
|
+
<dl class="constants">
|
120
|
+
|
121
|
+
<dt id="OPTIONAL-constant" class="">OPTIONAL =
|
122
|
+
<div class="docstring">
|
123
|
+
<div class="discussion">
|
124
|
+
|
125
|
+
<p>shorthand to indicate the parameter is optional.</p>
|
126
|
+
|
127
|
+
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
<div class="tags">
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
134
|
+
</dt>
|
135
|
+
<dd><pre class="code"><span class='lbrace'>{</span> <span class='label'>optional:</span> <span class='kw'>true</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
136
|
+
|
137
|
+
</dl>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<h2>
|
148
|
+
Instance Method Summary
|
149
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
150
|
+
</h2>
|
151
|
+
|
152
|
+
<ul class="summary">
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#assign_args-instance_method" title="#assign_args (instance method)">- (Object) <strong>assign_args</strong>(dest, args) </a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Goes through, and assigns the value for each declared parameter to an
|
173
|
+
accessor with the same name.</p>
|
174
|
+
</div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
<li class="public ">
|
180
|
+
<span class="summary_signature">
|
181
|
+
|
182
|
+
<a href="#description-instance_method" title="#description (instance method)">- (Object) <strong>description</strong> </a>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<span class="summary_desc"><div class='inline'>
|
197
|
+
<p>Returns the description for this command.</p>
|
198
|
+
</div></span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
<li class="public ">
|
204
|
+
<span class="summary_signature">
|
205
|
+
|
206
|
+
<a href="#help%3F-instance_method" title="#help? (instance method)">- (Boolean) <strong>help?</strong>(args) </a>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (InputOutput) <strong>initialize</strong>(action, desc) </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
<span class="note title constructor">constructor</span>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
<span class="summary_desc"><div class='inline'>
|
245
|
+
<p>Do not use this.</p>
|
246
|
+
</div></span>
|
247
|
+
|
248
|
+
</li>
|
249
|
+
|
250
|
+
|
251
|
+
<li class="public ">
|
252
|
+
<span class="summary_signature">
|
253
|
+
|
254
|
+
<a href="#input-instance_method" title="#input (instance method)">- (Object) <strong>input</strong>(sym, desc, opts = {}) </a>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
</span>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<span class="summary_desc"><div class='inline'>
|
269
|
+
<p>Defines input for a command.</p>
|
270
|
+
</div></span>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
<li class="public ">
|
276
|
+
<span class="summary_signature">
|
277
|
+
|
278
|
+
<a href="#keys-instance_method" title="#keys (instance method)">- (Object) <strong>keys</strong> </a>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
<span class="summary_desc"><div class='inline'>
|
293
|
+
<p>An array with the set of parameter symbols this command accepts.</p>
|
294
|
+
</div></span>
|
295
|
+
|
296
|
+
</li>
|
297
|
+
|
298
|
+
|
299
|
+
<li class="public ">
|
300
|
+
<span class="summary_signature">
|
301
|
+
|
302
|
+
<a href="#show_help-instance_method" title="#show_help (instance method)">- (Object) <strong>show_help</strong> </a>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
</span>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<span class="summary_desc"><div class='inline'>
|
317
|
+
<p>displays the help for this command.</p>
|
318
|
+
</div></span>
|
319
|
+
|
320
|
+
</li>
|
321
|
+
|
322
|
+
|
323
|
+
<li class="public ">
|
324
|
+
<span class="summary_signature">
|
325
|
+
|
326
|
+
<a href="#validate-instance_method" title="#validate (instance method)">- (Object) <strong>validate</strong>(args) </a>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
</span>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<span class="summary_desc"><div class='inline'>
|
341
|
+
<p>Validates that the specified parameters are valid for this input
|
342
|
+
description.</p>
|
343
|
+
</div></span>
|
344
|
+
|
345
|
+
</li>
|
346
|
+
|
347
|
+
|
348
|
+
</ul>
|
349
|
+
|
350
|
+
|
351
|
+
<div id="constructor_details" class="method_details_list">
|
352
|
+
<h2>Constructor Details</h2>
|
353
|
+
|
354
|
+
<div class="method_details first">
|
355
|
+
<h3 class="signature first" id="initialize-instance_method">
|
356
|
+
|
357
|
+
- (<tt><span class='object_link'><a href="" title="ActionCommand::InputOutput (class)">InputOutput</a></span></tt>) <strong>initialize</strong>(action, desc)
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</h3><div class="docstring">
|
364
|
+
<div class="discussion">
|
365
|
+
|
366
|
+
<p>Do not use this. Instead, implment self.describe_io in your command
|
367
|
+
subclass, and call the method ActionCommand#self.describe_io from within
|
368
|
+
it, returning its result.</p>
|
369
|
+
|
370
|
+
|
371
|
+
</div>
|
372
|
+
</div>
|
373
|
+
<div class="tags">
|
374
|
+
|
375
|
+
|
376
|
+
</div><table class="source_code">
|
377
|
+
<tr>
|
378
|
+
<td>
|
379
|
+
<pre class="lines">
|
380
|
+
|
381
|
+
|
382
|
+
154
|
383
|
+
155
|
384
|
+
156
|
385
|
+
157
|
386
|
+
158
|
387
|
+
159
|
388
|
+
160
|
389
|
+
161
|
390
|
+
162
|
391
|
+
163
|
392
|
+
164
|
393
|
+
165</pre>
|
394
|
+
</td>
|
395
|
+
<td>
|
396
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 154</span>
|
397
|
+
|
398
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_desc'>desc</span><span class='rparen'>)</span>
|
399
|
+
<span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span>
|
400
|
+
<span class='ivar'>@desc</span> <span class='op'>=</span> <span class='id identifier rubyid_desc'>desc</span>
|
401
|
+
<span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
402
|
+
|
403
|
+
<span class='comment'># universal parameters.
|
404
|
+
</span> <span class='id identifier rubyid_input'>input</span><span class='lparen'>(</span><span class='symbol'>:help</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Help on this command</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='const'>OPTIONAL</span><span class='rparen'>)</span>
|
405
|
+
<span class='id identifier rubyid_input'>input</span><span class='lparen'>(</span><span class='symbol'>:test</span><span class='comma'>,</span>
|
406
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Optional rspec context for performing validations via rspec_validate</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
407
|
+
<span class='const'>OPTIONAL</span><span class='rparen'>)</span>
|
408
|
+
<span class='id identifier rubyid_input'>input</span><span class='lparen'>(</span><span class='symbol'>:parent</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Reference to the parent of this command, a symbol at the root</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='const'>OPTIONAL</span><span class='rparen'>)</span>
|
409
|
+
<span class='kw'>end</span></pre>
|
410
|
+
</td>
|
411
|
+
</tr>
|
412
|
+
</table>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
</div>
|
416
|
+
|
417
|
+
|
418
|
+
<div id="instance_method_details" class="method_details_list">
|
419
|
+
<h2>Instance Method Details</h2>
|
420
|
+
|
421
|
+
|
422
|
+
<div class="method_details first">
|
423
|
+
<h3 class="signature first" id="assign_args-instance_method">
|
424
|
+
|
425
|
+
- (<tt>Object</tt>) <strong>assign_args</strong>(dest, args)
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</h3><div class="docstring">
|
432
|
+
<div class="discussion">
|
433
|
+
|
434
|
+
<p>Goes through, and assigns the value for each declared parameter to an
|
435
|
+
accessor with the same name.</p>
|
436
|
+
|
437
|
+
|
438
|
+
</div>
|
439
|
+
</div>
|
440
|
+
<div class="tags">
|
441
|
+
|
442
|
+
|
443
|
+
</div><table class="source_code">
|
444
|
+
<tr>
|
445
|
+
<td>
|
446
|
+
<pre class="lines">
|
447
|
+
|
448
|
+
|
449
|
+
186
|
450
|
+
187
|
451
|
+
188
|
452
|
+
189
|
453
|
+
190
|
454
|
+
191
|
455
|
+
192
|
456
|
+
193
|
457
|
+
194
|
458
|
+
195
|
459
|
+
196
|
460
|
+
197</pre>
|
461
|
+
</td>
|
462
|
+
<td>
|
463
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 186</span>
|
464
|
+
|
465
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_assign_args'>assign_args</span><span class='lparen'>(</span><span class='id identifier rubyid_dest'>dest</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
466
|
+
<span class='comment'># handle aliasing
|
467
|
+
</span> <span class='kw'>if</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>
|
468
|
+
<span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_param'>param</span><span class='op'>|</span>
|
469
|
+
<span class='id identifier rubyid_sym'>sym</span> <span class='op'>=</span> <span class='id identifier rubyid_param'>param</span><span class='lbracket'>[</span><span class='symbol'>:symbol</span><span class='rbracket'>]</span>
|
470
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span> <span class='id identifier rubyid_sym'>sym</span>
|
471
|
+
<span class='id identifier rubyid_sym_assign'>sym_assign</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sym'>sym</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
472
|
+
<span class='id identifier rubyid_dest'>dest</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_sym_assign'>sym_assign</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='id identifier rubyid_sym'>sym</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
473
|
+
<span class='kw'>end</span>
|
474
|
+
<span class='kw'>end</span>
|
475
|
+
<span class='kw'>end</span>
|
476
|
+
<span class='kw'>end</span></pre>
|
477
|
+
</td>
|
478
|
+
</tr>
|
479
|
+
</table>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
<div class="method_details ">
|
483
|
+
<h3 class="signature " id="description-instance_method">
|
484
|
+
|
485
|
+
- (<tt>Object</tt>) <strong>description</strong>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
</h3><div class="docstring">
|
492
|
+
<div class="discussion">
|
493
|
+
|
494
|
+
<p>Returns the description for this command.</p>
|
495
|
+
|
496
|
+
|
497
|
+
</div>
|
498
|
+
</div>
|
499
|
+
<div class="tags">
|
500
|
+
|
501
|
+
|
502
|
+
</div><table class="source_code">
|
503
|
+
<tr>
|
504
|
+
<td>
|
505
|
+
<pre class="lines">
|
506
|
+
|
507
|
+
|
508
|
+
200
|
509
|
+
201
|
510
|
+
202</pre>
|
511
|
+
</td>
|
512
|
+
<td>
|
513
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 200</span>
|
514
|
+
|
515
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span>
|
516
|
+
<span class='ivar'>@desc</span>
|
517
|
+
<span class='kw'>end</span></pre>
|
518
|
+
</td>
|
519
|
+
</tr>
|
520
|
+
</table>
|
521
|
+
</div>
|
522
|
+
|
523
|
+
<div class="method_details ">
|
524
|
+
<h3 class="signature " id="help?-instance_method">
|
525
|
+
|
526
|
+
- (<tt>Boolean</tt>) <strong>help?</strong>(args)
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
</h3><div class="docstring">
|
533
|
+
<div class="discussion">
|
534
|
+
|
535
|
+
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
<div class="tags">
|
539
|
+
|
540
|
+
<p class="tag_title">Returns:</p>
|
541
|
+
<ul class="return">
|
542
|
+
|
543
|
+
<li>
|
544
|
+
|
545
|
+
|
546
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
</li>
|
551
|
+
|
552
|
+
</ul>
|
553
|
+
|
554
|
+
</div><table class="source_code">
|
555
|
+
<tr>
|
556
|
+
<td>
|
557
|
+
<pre class="lines">
|
558
|
+
|
559
|
+
|
560
|
+
205
|
561
|
+
206
|
562
|
+
207
|
563
|
+
208
|
564
|
+
209</pre>
|
565
|
+
</td>
|
566
|
+
<td>
|
567
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 205</span>
|
568
|
+
|
569
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_help?'>help?</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
570
|
+
<span class='id identifier rubyid_first_arg_sym'>first_arg_sym</span> <span class='op'>=</span> <span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='lbracket'>[</span><span class='symbol'>:symbol</span><span class='rbracket'>]</span>
|
571
|
+
<span class='id identifier rubyid_first_arg_val'>first_arg_val</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='id identifier rubyid_first_arg_sym'>first_arg_sym</span><span class='rbracket'>]</span>
|
572
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_first_arg_val'>first_arg_val</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>help</span><span class='tstring_end'>'</span></span>
|
573
|
+
<span class='kw'>end</span></pre>
|
574
|
+
</td>
|
575
|
+
</tr>
|
576
|
+
</table>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
<div class="method_details ">
|
580
|
+
<h3 class="signature " id="input-instance_method">
|
581
|
+
|
582
|
+
- (<tt>Object</tt>) <strong>input</strong>(sym, desc, opts = {})
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
</h3><div class="docstring">
|
589
|
+
<div class="discussion">
|
590
|
+
|
591
|
+
<p>Defines input for a command</p>
|
592
|
+
|
593
|
+
|
594
|
+
</div>
|
595
|
+
</div>
|
596
|
+
<div class="tags">
|
597
|
+
<p class="tag_title">Parameters:</p>
|
598
|
+
<ul class="param">
|
599
|
+
|
600
|
+
<li>
|
601
|
+
|
602
|
+
<span class='name'>sym</span>
|
603
|
+
|
604
|
+
|
605
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
—
|
610
|
+
<div class='inline'>
|
611
|
+
<p>symbol identifying the parameter</p>
|
612
|
+
</div>
|
613
|
+
|
614
|
+
</li>
|
615
|
+
|
616
|
+
<li>
|
617
|
+
|
618
|
+
<span class='name'>desc</span>
|
619
|
+
|
620
|
+
|
621
|
+
<span class='type'>(<tt>String</tt>)</span>
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
—
|
626
|
+
<div class='inline'>
|
627
|
+
<p>description for use by internal developers, or on a rake task with rake <a
|
628
|
+
href="help">your_task_name</a></p>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
</li>
|
632
|
+
|
633
|
+
<li>
|
634
|
+
|
635
|
+
<span class='name'>opts</span>
|
636
|
+
|
637
|
+
|
638
|
+
<span class='type'></span>
|
639
|
+
|
640
|
+
|
641
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
642
|
+
|
643
|
+
|
644
|
+
—
|
645
|
+
<div class='inline'>
|
646
|
+
<p>Optional arguments.</p>
|
647
|
+
</div>
|
648
|
+
|
649
|
+
</li>
|
650
|
+
|
651
|
+
</ul>
|
652
|
+
|
653
|
+
|
654
|
+
</div><table class="source_code">
|
655
|
+
<tr>
|
656
|
+
<td>
|
657
|
+
<pre class="lines">
|
658
|
+
|
659
|
+
|
660
|
+
224
|
661
|
+
225
|
662
|
+
226</pre>
|
663
|
+
</td>
|
664
|
+
<td>
|
665
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 224</span>
|
666
|
+
|
667
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_input'>input</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='comma'>,</span> <span class='id identifier rubyid_desc'>desc</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
668
|
+
<span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='label'>symbol:</span> <span class='id identifier rubyid_sym'>sym</span><span class='comma'>,</span> <span class='label'>desc:</span> <span class='id identifier rubyid_desc'>desc</span><span class='comma'>,</span> <span class='label'>opts:</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
669
|
+
<span class='kw'>end</span></pre>
|
670
|
+
</td>
|
671
|
+
</tr>
|
672
|
+
</table>
|
673
|
+
</div>
|
674
|
+
|
675
|
+
<div class="method_details ">
|
676
|
+
<h3 class="signature " id="keys-instance_method">
|
677
|
+
|
678
|
+
- (<tt>Object</tt>) <strong>keys</strong>
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
</h3><div class="docstring">
|
685
|
+
<div class="discussion">
|
686
|
+
|
687
|
+
<p>Returns an array with the set of parameter symbols this command accepts.</p>
|
688
|
+
|
689
|
+
|
690
|
+
</div>
|
691
|
+
</div>
|
692
|
+
<div class="tags">
|
693
|
+
|
694
|
+
<p class="tag_title">Returns:</p>
|
695
|
+
<ul class="return">
|
696
|
+
|
697
|
+
<li>
|
698
|
+
|
699
|
+
|
700
|
+
<span class='type'></span>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
<div class='inline'>
|
706
|
+
<p>an array with the set of parameter symbols this command accepts.</p>
|
707
|
+
</div>
|
708
|
+
|
709
|
+
</li>
|
710
|
+
|
711
|
+
</ul>
|
712
|
+
|
713
|
+
</div><table class="source_code">
|
714
|
+
<tr>
|
715
|
+
<td>
|
716
|
+
<pre class="lines">
|
717
|
+
|
718
|
+
|
719
|
+
229
|
720
|
+
230
|
721
|
+
231</pre>
|
722
|
+
</td>
|
723
|
+
<td>
|
724
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 229</span>
|
725
|
+
|
726
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_keys'>keys</span>
|
727
|
+
<span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:symbol</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
|
728
|
+
<span class='kw'>end</span></pre>
|
729
|
+
</td>
|
730
|
+
</tr>
|
731
|
+
</table>
|
732
|
+
</div>
|
733
|
+
|
734
|
+
<div class="method_details ">
|
735
|
+
<h3 class="signature " id="show_help-instance_method">
|
736
|
+
|
737
|
+
- (<tt>Object</tt>) <strong>show_help</strong>
|
738
|
+
|
739
|
+
|
740
|
+
|
741
|
+
|
742
|
+
|
743
|
+
</h3><div class="docstring">
|
744
|
+
<div class="discussion">
|
745
|
+
|
746
|
+
<p>displays the help for this command</p>
|
747
|
+
|
748
|
+
|
749
|
+
</div>
|
750
|
+
</div>
|
751
|
+
<div class="tags">
|
752
|
+
|
753
|
+
|
754
|
+
</div><table class="source_code">
|
755
|
+
<tr>
|
756
|
+
<td>
|
757
|
+
<pre class="lines">
|
758
|
+
|
759
|
+
|
760
|
+
212
|
761
|
+
213
|
762
|
+
214
|
763
|
+
215
|
764
|
+
216
|
765
|
+
217</pre>
|
766
|
+
</td>
|
767
|
+
<td>
|
768
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 212</span>
|
769
|
+
|
770
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_show_help'>show_help</span>
|
771
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@action</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_description'>description</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
772
|
+
<span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span>
|
773
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:symbol</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:desc</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
774
|
+
<span class='kw'>end</span>
|
775
|
+
<span class='kw'>end</span></pre>
|
776
|
+
</td>
|
777
|
+
</tr>
|
778
|
+
</table>
|
779
|
+
</div>
|
780
|
+
|
781
|
+
<div class="method_details ">
|
782
|
+
<h3 class="signature " id="validate-instance_method">
|
783
|
+
|
784
|
+
- (<tt>Object</tt>) <strong>validate</strong>(args)
|
785
|
+
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
|
790
|
+
</h3><div class="docstring">
|
791
|
+
<div class="discussion">
|
792
|
+
|
793
|
+
<p>Validates that the specified parameters are valid for this input
|
794
|
+
description.</p>
|
795
|
+
|
796
|
+
|
797
|
+
</div>
|
798
|
+
</div>
|
799
|
+
<div class="tags">
|
800
|
+
<p class="tag_title">Parameters:</p>
|
801
|
+
<ul class="param">
|
802
|
+
|
803
|
+
<li>
|
804
|
+
|
805
|
+
<span class='name'>args</span>
|
806
|
+
|
807
|
+
|
808
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
809
|
+
|
810
|
+
|
811
|
+
|
812
|
+
—
|
813
|
+
<div class='inline'>
|
814
|
+
<p>the arguments to validate</p>
|
815
|
+
</div>
|
816
|
+
|
817
|
+
</li>
|
818
|
+
|
819
|
+
</ul>
|
820
|
+
|
821
|
+
|
822
|
+
</div><table class="source_code">
|
823
|
+
<tr>
|
824
|
+
<td>
|
825
|
+
<pre class="lines">
|
826
|
+
|
827
|
+
|
828
|
+
169
|
829
|
+
170
|
830
|
+
171
|
831
|
+
172
|
832
|
+
173
|
833
|
+
174
|
834
|
+
175
|
835
|
+
176
|
836
|
+
177
|
837
|
+
178
|
838
|
+
179
|
839
|
+
180
|
840
|
+
181
|
841
|
+
182</pre>
|
842
|
+
</td>
|
843
|
+
<td>
|
844
|
+
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 169</span>
|
845
|
+
|
846
|
+
<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>
|
847
|
+
<span class='ivar'>@params</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span>
|
848
|
+
<span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:symbol</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
849
|
+
|
850
|
+
<span class='comment'># if the argument has a value, no need to test whether it is optional.
|
851
|
+
</span> <span class='kw'>next</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_val'>val</span> <span class='op'>||</span> <span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>*</span><span class='tstring_end'>'</span></span> <span class='op'>||</span> <span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
852
|
+
|
853
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:opts</span><span class='rbracket'>]</span>
|
854
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:optional</span><span class='rbracket'>]</span>
|
855
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the required input </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:symbol</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
856
|
+
<span class='kw'>end</span>
|
857
|
+
<span class='kw'>end</span>
|
858
|
+
<span class='kw'>return</span> <span class='kw'>true</span>
|
859
|
+
<span class='kw'>end</span></pre>
|
860
|
+
</td>
|
861
|
+
</tr>
|
862
|
+
</table>
|
863
|
+
</div>
|
864
|
+
|
865
|
+
</div>
|
866
|
+
|
867
|
+
</div>
|
868
|
+
|
869
|
+
<div id="footer">
|
870
|
+
Generated on Sat Feb 13 10:16:47 2016 by
|
871
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
872
|
+
0.8.7.6 (ruby-2.2.3).
|
873
|
+
</div>
|
874
|
+
|
875
|
+
</body>
|
876
|
+
</html>
|