action_command 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +106 -1
- data/Rakefile +2 -0
- data/doc/ActionCommand/Executable.html +452 -29
- data/doc/ActionCommand/InputOutput.html +559 -158
- data/doc/ActionCommand/Result.html +321 -32
- data/doc/ActionCommand.html +319 -65
- data/doc/_index.html +16 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +101 -2
- data/doc/index.html +101 -2
- data/doc/method_list.html +118 -16
- data/doc/top-level-namespace.html +1 -1
- data/lib/action_command/executable.rb +75 -0
- data/lib/action_command/input_output.rb +149 -0
- data/lib/action_command/result.rb +76 -0
- data/lib/action_command/utils.rb +21 -0
- data/lib/action_command/version.rb +1 -1
- data/lib/action_command.rb +35 -186
- metadata +6 -2
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
|
96
96
|
<dt class="r2 last">Defined in:</dt>
|
97
|
-
<dd class="r2 last">lib/action_command.rb</dd>
|
97
|
+
<dd class="r2 last">lib/action_command/input_output.rb</dd>
|
98
98
|
|
99
99
|
</dl>
|
100
100
|
<div class="clear"></div>
|
@@ -140,6 +140,40 @@ can just access the hash you passed into the command as @params</p>
|
|
140
140
|
|
141
141
|
|
142
142
|
|
143
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
144
|
+
<ul class="summary">
|
145
|
+
|
146
|
+
<li class="public ">
|
147
|
+
<span class="summary_signature">
|
148
|
+
|
149
|
+
<a href="#desc-instance_method" title="#desc (instance method)">- (Object) <strong>desc</strong> </a>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
</span>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="note title readonly">readonly</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'>
|
169
|
+
<p>Returns the description for this command.</p>
|
170
|
+
</div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
</ul>
|
176
|
+
|
143
177
|
|
144
178
|
|
145
179
|
|
@@ -154,7 +188,55 @@ can just access the hash you passed into the command as @params</p>
|
|
154
188
|
<li class="public ">
|
155
189
|
<span class="summary_signature">
|
156
190
|
|
157
|
-
<a href="#
|
191
|
+
<a href="#help%3F-instance_method" title="#help? (instance method)">- (Boolean) <strong>help?</strong>(args) </a>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
</span>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
206
|
+
|
207
|
+
</li>
|
208
|
+
|
209
|
+
|
210
|
+
<li class="public ">
|
211
|
+
<span class="summary_signature">
|
212
|
+
|
213
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (InputOutput) <strong>initialize</strong>(action, desc) </a>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
</span>
|
218
|
+
|
219
|
+
|
220
|
+
<span class="note title constructor">constructor</span>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<span class="summary_desc"><div class='inline'>
|
230
|
+
<p>Do not use this.</p>
|
231
|
+
</div></span>
|
232
|
+
|
233
|
+
</li>
|
234
|
+
|
235
|
+
|
236
|
+
<li class="public ">
|
237
|
+
<span class="summary_signature">
|
238
|
+
|
239
|
+
<a href="#input-instance_method" title="#input (instance method)">- (Object) <strong>input</strong>(sym, desc, opts = {}, &_block) </a>
|
158
240
|
|
159
241
|
|
160
242
|
|
@@ -169,8 +251,7 @@ can just access the hash you passed into the command as @params</p>
|
|
169
251
|
|
170
252
|
|
171
253
|
<span class="summary_desc"><div class='inline'>
|
172
|
-
<p>
|
173
|
-
accessor with the same name.</p>
|
254
|
+
<p>Defines input for a command.</p>
|
174
255
|
</div></span>
|
175
256
|
|
176
257
|
</li>
|
@@ -179,7 +260,7 @@ accessor with the same name.</p>
|
|
179
260
|
<li class="public ">
|
180
261
|
<span class="summary_signature">
|
181
262
|
|
182
|
-
<a href="#
|
263
|
+
<a href="#keys-instance_method" title="#keys (instance method)">- (Object) <strong>keys</strong> </a>
|
183
264
|
|
184
265
|
|
185
266
|
|
@@ -194,7 +275,7 @@ accessor with the same name.</p>
|
|
194
275
|
|
195
276
|
|
196
277
|
<span class="summary_desc"><div class='inline'>
|
197
|
-
<p>
|
278
|
+
<p>An array with the set of parameter symbols this command accepts.</p>
|
198
279
|
</div></span>
|
199
280
|
|
200
281
|
</li>
|
@@ -203,7 +284,7 @@ accessor with the same name.</p>
|
|
203
284
|
<li class="public ">
|
204
285
|
<span class="summary_signature">
|
205
286
|
|
206
|
-
<a href="#
|
287
|
+
<a href="#output-instance_method" title="#output (instance method)">- (Object) <strong>output</strong>(sym, desc, opts = {}) </a>
|
207
288
|
|
208
289
|
|
209
290
|
|
@@ -225,14 +306,36 @@ accessor with the same name.</p>
|
|
225
306
|
<li class="public ">
|
226
307
|
<span class="summary_signature">
|
227
308
|
|
228
|
-
<a href="#
|
309
|
+
<a href="#print_output-instance_method" title="#print_output (instance method)">- (Object) <strong>print_output</strong>(result) </a>
|
229
310
|
|
230
311
|
|
231
312
|
|
232
313
|
</span>
|
233
314
|
|
234
315
|
|
235
|
-
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
<span class="summary_desc"><div class='inline'>
|
324
|
+
<p>print out the defined output of the command.</p>
|
325
|
+
</div></span>
|
326
|
+
|
327
|
+
</li>
|
328
|
+
|
329
|
+
|
330
|
+
<li class="public ">
|
331
|
+
<span class="summary_signature">
|
332
|
+
|
333
|
+
<a href="#process_input-instance_method" title="#process_input (instance method)">- (Object) <strong>process_input</strong>(dest, args) </a>
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
</span>
|
338
|
+
|
236
339
|
|
237
340
|
|
238
341
|
|
@@ -242,7 +345,9 @@ accessor with the same name.</p>
|
|
242
345
|
|
243
346
|
|
244
347
|
<span class="summary_desc"><div class='inline'>
|
245
|
-
<p>
|
348
|
+
<p>Goes through, and assigns the value for each declared parameter to an
|
349
|
+
accessor with the same name, validating that required parameters are not
|
350
|
+
missing.</p>
|
246
351
|
</div></span>
|
247
352
|
|
248
353
|
</li>
|
@@ -251,7 +356,7 @@ accessor with the same name.</p>
|
|
251
356
|
<li class="public ">
|
252
357
|
<span class="summary_signature">
|
253
358
|
|
254
|
-
<a href="#
|
359
|
+
<a href="#process_output-instance_method" title="#process_output (instance method)">- (Object) <strong>process_output</strong>(dest, result) </a>
|
255
360
|
|
256
361
|
|
257
362
|
|
@@ -266,7 +371,7 @@ accessor with the same name.</p>
|
|
266
371
|
|
267
372
|
|
268
373
|
<span class="summary_desc"><div class='inline'>
|
269
|
-
<p>
|
374
|
+
<p>Goes through, and makes sure that required output parameters exist.</p>
|
270
375
|
</div></span>
|
271
376
|
|
272
377
|
</li>
|
@@ -275,7 +380,7 @@ accessor with the same name.</p>
|
|
275
380
|
<li class="public ">
|
276
381
|
<span class="summary_signature">
|
277
382
|
|
278
|
-
<a href="#
|
383
|
+
<a href="#rake_input-instance_method" title="#rake_input (instance method)">- (Object) <strong>rake_input</strong>(rake_arg) </a>
|
279
384
|
|
280
385
|
|
281
386
|
|
@@ -290,7 +395,31 @@ accessor with the same name.</p>
|
|
290
395
|
|
291
396
|
|
292
397
|
<span class="summary_desc"><div class='inline'>
|
293
|
-
<p>
|
398
|
+
<p>convert rake task arguments to a standard hash.</p>
|
399
|
+
</div></span>
|
400
|
+
|
401
|
+
</li>
|
402
|
+
|
403
|
+
|
404
|
+
<li class="public ">
|
405
|
+
<span class="summary_signature">
|
406
|
+
|
407
|
+
<a href="#should_validate-instance_method" title="#should_validate (instance method)">- (Object) <strong>should_validate</strong>(dest) </a>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
</span>
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
<span class="summary_desc"><div class='inline'>
|
422
|
+
<p>True if the executable is not in a testing context.</p>
|
294
423
|
</div></span>
|
295
424
|
|
296
425
|
</li>
|
@@ -323,7 +452,7 @@ accessor with the same name.</p>
|
|
323
452
|
<li class="public ">
|
324
453
|
<span class="summary_signature">
|
325
454
|
|
326
|
-
<a href="#
|
455
|
+
<a href="#validate_input-instance_method" title="#validate_input (instance method)">- (Object) <strong>validate_input</strong>(dest, args) </a>
|
327
456
|
|
328
457
|
|
329
458
|
|
@@ -379,34 +508,28 @@ it, returning its result.</p>
|
|
379
508
|
<pre class="lines">
|
380
509
|
|
381
510
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
163
|
392
|
-
164
|
393
|
-
165</pre>
|
511
|
+
14
|
512
|
+
15
|
513
|
+
16
|
514
|
+
17
|
515
|
+
18
|
516
|
+
19
|
517
|
+
20
|
518
|
+
21
|
519
|
+
22</pre>
|
394
520
|
</td>
|
395
521
|
<td>
|
396
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
522
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 14</span>
|
397
523
|
|
398
524
|
<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
525
|
<span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span>
|
400
526
|
<span class='ivar'>@desc</span> <span class='op'>=</span> <span class='id identifier rubyid_desc'>desc</span>
|
401
|
-
<span class='ivar'>@
|
527
|
+
<span class='ivar'>@input</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
528
|
+
<span class='ivar'>@output</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
402
529
|
|
403
530
|
<span class='comment'># universal parameters.
|
404
|
-
</span> <span class='
|
405
|
-
|
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>
|
531
|
+
</span> <span class='comment'># input(:help, 'Help on this command', OPTIONAL)
|
532
|
+
</span><span class='kw'>end</span></pre>
|
410
533
|
</td>
|
411
534
|
</tr>
|
412
535
|
</table>
|
@@ -414,15 +537,15 @@ it, returning its result.</p>
|
|
414
537
|
|
415
538
|
</div>
|
416
539
|
|
417
|
-
|
418
|
-
|
419
|
-
<h2>Instance Method Details</h2>
|
420
|
-
|
540
|
+
<div id="instance_attr_details" class="attr_details">
|
541
|
+
<h2>Instance Attribute Details</h2>
|
421
542
|
|
543
|
+
|
544
|
+
<span id=""></span>
|
422
545
|
<div class="method_details first">
|
423
|
-
<h3 class="signature first" id="
|
546
|
+
<h3 class="signature first" id="desc-instance_method">
|
424
547
|
|
425
|
-
- (<tt>Object</tt>) <strong>
|
548
|
+
- (<tt>Object</tt>) <strong>desc</strong> <span class="extras">(readonly)</span>
|
426
549
|
|
427
550
|
|
428
551
|
|
@@ -431,8 +554,7 @@ it, returning its result.</p>
|
|
431
554
|
</h3><div class="docstring">
|
432
555
|
<div class="discussion">
|
433
556
|
|
434
|
-
<p>
|
435
|
-
accessor with the same name.</p>
|
557
|
+
<p>Returns the description for this command.</p>
|
436
558
|
|
437
559
|
|
438
560
|
</div>
|
@@ -446,82 +568,30 @@ accessor with the same name.</p>
|
|
446
568
|
<pre class="lines">
|
447
569
|
|
448
570
|
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
189
|
453
|
-
190
|
454
|
-
191
|
455
|
-
192
|
456
|
-
193
|
457
|
-
194
|
458
|
-
195
|
459
|
-
196
|
460
|
-
197</pre>
|
571
|
+
98
|
572
|
+
99
|
573
|
+
100</pre>
|
461
574
|
</td>
|
462
575
|
<td>
|
463
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
464
|
-
|
465
|
-
<span class='kw'>def</span> <span class='id identifier
|
466
|
-
<span class='
|
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>
|
576
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 98</span>
|
577
|
+
|
578
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_desc'>desc</span>
|
579
|
+
<span class='ivar'>@desc</span>
|
476
580
|
<span class='kw'>end</span></pre>
|
477
581
|
</td>
|
478
582
|
</tr>
|
479
583
|
</table>
|
480
584
|
</div>
|
481
585
|
|
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
586
|
</div>
|
498
|
-
</div>
|
499
|
-
<div class="tags">
|
500
|
-
|
501
|
-
|
502
|
-
</div><table class="source_code">
|
503
|
-
<tr>
|
504
|
-
<td>
|
505
|
-
<pre class="lines">
|
506
587
|
|
507
588
|
|
508
|
-
|
509
|
-
|
510
|
-
202</pre>
|
511
|
-
</td>
|
512
|
-
<td>
|
513
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line 200</span>
|
589
|
+
<div id="instance_method_details" class="method_details_list">
|
590
|
+
<h2>Instance Method Details</h2>
|
514
591
|
|
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
592
|
|
523
|
-
<div class="method_details ">
|
524
|
-
<h3 class="signature " id="help?-instance_method">
|
593
|
+
<div class="method_details first">
|
594
|
+
<h3 class="signature first" id="help?-instance_method">
|
525
595
|
|
526
596
|
- (<tt>Boolean</tt>) <strong>help?</strong>(args)
|
527
597
|
|
@@ -557,17 +627,17 @@ accessor with the same name.</p>
|
|
557
627
|
<pre class="lines">
|
558
628
|
|
559
629
|
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
630
|
+
101
|
631
|
+
102
|
632
|
+
103
|
633
|
+
104
|
634
|
+
105</pre>
|
565
635
|
</td>
|
566
636
|
<td>
|
567
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
637
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 101</span>
|
568
638
|
|
569
639
|
<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'>@
|
640
|
+
<span class='id identifier rubyid_first_arg_sym'>first_arg_sym</span> <span class='op'>=</span> <span class='ivar'>@input</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
641
|
<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
642
|
<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
643
|
<span class='kw'>end</span></pre>
|
@@ -579,7 +649,7 @@ accessor with the same name.</p>
|
|
579
649
|
<div class="method_details ">
|
580
650
|
<h3 class="signature " id="input-instance_method">
|
581
651
|
|
582
|
-
- (<tt>Object</tt>) <strong>input</strong>(sym, desc, opts = {})
|
652
|
+
- (<tt>Object</tt>) <strong>input</strong>(sym, desc, opts = {}, &_block)
|
583
653
|
|
584
654
|
|
585
655
|
|
@@ -657,15 +727,15 @@ href="help">your_task_name</a></p>
|
|
657
727
|
<pre class="lines">
|
658
728
|
|
659
729
|
|
660
|
-
|
661
|
-
|
662
|
-
|
730
|
+
120
|
731
|
+
121
|
732
|
+
122</pre>
|
663
733
|
</td>
|
664
734
|
<td>
|
665
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
735
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 120</span>
|
666
736
|
|
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='
|
737
|
+
<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='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid__block'>_block</span><span class='rparen'>)</span>
|
738
|
+
<span class='id identifier rubyid_insert_io'>insert_io</span><span class='lparen'>(</span><span class='ivar'>@input</span><span class='comma'>,</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='rparen'>)</span>
|
669
739
|
<span class='kw'>end</span></pre>
|
670
740
|
</td>
|
671
741
|
</tr>
|
@@ -716,15 +786,346 @@ href="help">your_task_name</a></p>
|
|
716
786
|
<pre class="lines">
|
717
787
|
|
718
788
|
|
719
|
-
|
720
|
-
|
721
|
-
|
789
|
+
129
|
790
|
+
130
|
791
|
+
131</pre>
|
722
792
|
</td>
|
723
793
|
<td>
|
724
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
794
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 129</span>
|
725
795
|
|
726
796
|
<span class='kw'>def</span> <span class='id identifier rubyid_keys'>keys</span>
|
727
|
-
<span class='ivar'>@
|
797
|
+
<span class='ivar'>@input</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>
|
798
|
+
<span class='kw'>end</span></pre>
|
799
|
+
</td>
|
800
|
+
</tr>
|
801
|
+
</table>
|
802
|
+
</div>
|
803
|
+
|
804
|
+
<div class="method_details ">
|
805
|
+
<h3 class="signature " id="output-instance_method">
|
806
|
+
|
807
|
+
- (<tt>Object</tt>) <strong>output</strong>(sym, desc, opts = {})
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
|
812
|
+
|
813
|
+
</h3><table class="source_code">
|
814
|
+
<tr>
|
815
|
+
<td>
|
816
|
+
<pre class="lines">
|
817
|
+
|
818
|
+
|
819
|
+
124
|
820
|
+
125
|
821
|
+
126</pre>
|
822
|
+
</td>
|
823
|
+
<td>
|
824
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 124</span>
|
825
|
+
|
826
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_output'>output</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>
|
827
|
+
<span class='id identifier rubyid_insert_io'>insert_io</span><span class='lparen'>(</span><span class='ivar'>@output</span><span class='comma'>,</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='rparen'>)</span>
|
828
|
+
<span class='kw'>end</span></pre>
|
829
|
+
</td>
|
830
|
+
</tr>
|
831
|
+
</table>
|
832
|
+
</div>
|
833
|
+
|
834
|
+
<div class="method_details ">
|
835
|
+
<h3 class="signature " id="print_output-instance_method">
|
836
|
+
|
837
|
+
- (<tt>Object</tt>) <strong>print_output</strong>(result)
|
838
|
+
|
839
|
+
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
</h3><div class="docstring">
|
844
|
+
<div class="discussion">
|
845
|
+
|
846
|
+
<p>print out the defined output of the command</p>
|
847
|
+
|
848
|
+
|
849
|
+
</div>
|
850
|
+
</div>
|
851
|
+
<div class="tags">
|
852
|
+
|
853
|
+
|
854
|
+
</div><table class="source_code">
|
855
|
+
<tr>
|
856
|
+
<td>
|
857
|
+
<pre class="lines">
|
858
|
+
|
859
|
+
|
860
|
+
89
|
861
|
+
90
|
862
|
+
91
|
863
|
+
92
|
864
|
+
93
|
865
|
+
94
|
866
|
+
95</pre>
|
867
|
+
</td>
|
868
|
+
<td>
|
869
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 89</span>
|
870
|
+
|
871
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_print_output'>print_output</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
872
|
+
<span class='ivar'>@output</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>
|
873
|
+
<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>
|
874
|
+
<span class='id identifier rubyid_puts'>puts</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='embexpr_beg'>#{</span><span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='id identifier rubyid_sym'>sym</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
875
|
+
<span class='kw'>end</span>
|
876
|
+
|
877
|
+
<span class='kw'>end</span></pre>
|
878
|
+
</td>
|
879
|
+
</tr>
|
880
|
+
</table>
|
881
|
+
</div>
|
882
|
+
|
883
|
+
<div class="method_details ">
|
884
|
+
<h3 class="signature " id="process_input-instance_method">
|
885
|
+
|
886
|
+
- (<tt>Object</tt>) <strong>process_input</strong>(dest, args)
|
887
|
+
|
888
|
+
|
889
|
+
|
890
|
+
|
891
|
+
|
892
|
+
</h3><div class="docstring">
|
893
|
+
<div class="discussion">
|
894
|
+
|
895
|
+
<p>Goes through, and assigns the value for each declared parameter to an
|
896
|
+
accessor with the same name, validating that required parameters are not
|
897
|
+
missing</p>
|
898
|
+
|
899
|
+
|
900
|
+
</div>
|
901
|
+
</div>
|
902
|
+
<div class="tags">
|
903
|
+
|
904
|
+
|
905
|
+
</div><table class="source_code">
|
906
|
+
<tr>
|
907
|
+
<td>
|
908
|
+
<pre class="lines">
|
909
|
+
|
910
|
+
|
911
|
+
50
|
912
|
+
51
|
913
|
+
52
|
914
|
+
53
|
915
|
+
54
|
916
|
+
55
|
917
|
+
56
|
918
|
+
57
|
919
|
+
58
|
920
|
+
59
|
921
|
+
60
|
922
|
+
61
|
923
|
+
62
|
924
|
+
63
|
925
|
+
64</pre>
|
926
|
+
</td>
|
927
|
+
<td>
|
928
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 50</span>
|
929
|
+
|
930
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_input'>process_input</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>
|
931
|
+
<span class='comment'># pass down predefined attributes.
|
932
|
+
</span> <span class='id identifier rubyid_dest'>dest</span><span class='period'>.</span><span class='id identifier rubyid_parent'>parent</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:parent</span><span class='rbracket'>]</span>
|
933
|
+
<span class='id identifier rubyid_dest'>dest</span><span class='period'>.</span><span class='id identifier rubyid_test'>test</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:test</span><span class='rbracket'>]</span>
|
934
|
+
|
935
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_validate_input'>validate_input</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>
|
936
|
+
|
937
|
+
<span class='ivar'>@input</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>
|
938
|
+
<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>
|
939
|
+
<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>
|
940
|
+
<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>
|
941
|
+
<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>
|
942
|
+
<span class='kw'>end</span>
|
943
|
+
<span class='kw'>end</span>
|
944
|
+
<span class='kw'>end</span></pre>
|
945
|
+
</td>
|
946
|
+
</tr>
|
947
|
+
</table>
|
948
|
+
</div>
|
949
|
+
|
950
|
+
<div class="method_details ">
|
951
|
+
<h3 class="signature " id="process_output-instance_method">
|
952
|
+
|
953
|
+
- (<tt>Object</tt>) <strong>process_output</strong>(dest, result)
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
|
959
|
+
</h3><div class="docstring">
|
960
|
+
<div class="discussion">
|
961
|
+
|
962
|
+
<p>Goes through, and makes sure that required output parameters exist</p>
|
963
|
+
|
964
|
+
|
965
|
+
</div>
|
966
|
+
</div>
|
967
|
+
<div class="tags">
|
968
|
+
|
969
|
+
|
970
|
+
</div><table class="source_code">
|
971
|
+
<tr>
|
972
|
+
<td>
|
973
|
+
<pre class="lines">
|
974
|
+
|
975
|
+
|
976
|
+
67
|
977
|
+
68
|
978
|
+
69
|
979
|
+
70
|
980
|
+
71
|
981
|
+
72
|
982
|
+
73
|
983
|
+
74
|
984
|
+
75
|
985
|
+
76
|
986
|
+
77</pre>
|
987
|
+
</td>
|
988
|
+
<td>
|
989
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 67</span>
|
990
|
+
|
991
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_output'>process_output</span><span class='lparen'>(</span><span class='id identifier rubyid_dest'>dest</span><span class='comma'>,</span> <span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
992
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_should_validate'>should_validate</span><span class='lparen'>(</span><span class='id identifier rubyid_dest'>dest</span><span class='rparen'>)</span>
|
993
|
+
|
994
|
+
<span class='ivar'>@output</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>
|
995
|
+
<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>
|
996
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span>
|
997
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='id identifier rubyid_param'>param</span><span class='lbracket'>[</span><span class='symbol'>:opts</span><span class='rbracket'>]</span>
|
998
|
+
<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'>Missing required value </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sym'>sym</span><span class='embexpr_end'>}</span><span class='tstring_content'> in output</span><span class='tstring_end'>"</span></span> <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>
|
999
|
+
<span class='kw'>end</span>
|
1000
|
+
<span class='kw'>end</span>
|
1001
|
+
<span class='kw'>end</span></pre>
|
1002
|
+
</td>
|
1003
|
+
</tr>
|
1004
|
+
</table>
|
1005
|
+
</div>
|
1006
|
+
|
1007
|
+
<div class="method_details ">
|
1008
|
+
<h3 class="signature " id="rake_input-instance_method">
|
1009
|
+
|
1010
|
+
- (<tt>Object</tt>) <strong>rake_input</strong>(rake_arg)
|
1011
|
+
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
</h3><div class="docstring">
|
1017
|
+
<div class="discussion">
|
1018
|
+
|
1019
|
+
<p>convert rake task arguments to a standard hash.</p>
|
1020
|
+
|
1021
|
+
|
1022
|
+
</div>
|
1023
|
+
</div>
|
1024
|
+
<div class="tags">
|
1025
|
+
|
1026
|
+
|
1027
|
+
</div><table class="source_code">
|
1028
|
+
<tr>
|
1029
|
+
<td>
|
1030
|
+
<pre class="lines">
|
1031
|
+
|
1032
|
+
|
1033
|
+
80
|
1034
|
+
81
|
1035
|
+
82
|
1036
|
+
83
|
1037
|
+
84
|
1038
|
+
85
|
1039
|
+
86</pre>
|
1040
|
+
</td>
|
1041
|
+
<td>
|
1042
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 80</span>
|
1043
|
+
|
1044
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_rake_input'>rake_input</span><span class='lparen'>(</span><span class='id identifier rubyid_rake_arg'>rake_arg</span><span class='rparen'>)</span>
|
1045
|
+
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1046
|
+
<span class='id identifier rubyid_rake_arg'>rake_arg</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='op'>|</span>
|
1047
|
+
<span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span>
|
1048
|
+
<span class='kw'>end</span>
|
1049
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_params'>params</span>
|
1050
|
+
<span class='kw'>end</span></pre>
|
1051
|
+
</td>
|
1052
|
+
</tr>
|
1053
|
+
</table>
|
1054
|
+
</div>
|
1055
|
+
|
1056
|
+
<div class="method_details ">
|
1057
|
+
<h3 class="signature " id="should_validate-instance_method">
|
1058
|
+
|
1059
|
+
- (<tt>Object</tt>) <strong>should_validate</strong>(dest)
|
1060
|
+
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1064
|
+
|
1065
|
+
</h3><div class="docstring">
|
1066
|
+
<div class="discussion">
|
1067
|
+
|
1068
|
+
<p>Returns true if the executable is not in a testing context.</p>
|
1069
|
+
|
1070
|
+
|
1071
|
+
</div>
|
1072
|
+
</div>
|
1073
|
+
<div class="tags">
|
1074
|
+
<p class="tag_title">Parameters:</p>
|
1075
|
+
<ul class="param">
|
1076
|
+
|
1077
|
+
<li>
|
1078
|
+
|
1079
|
+
<span class='name'>dest</span>
|
1080
|
+
|
1081
|
+
|
1082
|
+
<span class='type'>(<tt><span class='object_link'><a href="Executable.html" title="ActionCommand::Executable (class)">ActionCommand::Executable</a></span></tt>)</span>
|
1083
|
+
|
1084
|
+
|
1085
|
+
|
1086
|
+
—
|
1087
|
+
<div class='inline'>
|
1088
|
+
<p>the executable in question</p>
|
1089
|
+
</div>
|
1090
|
+
|
1091
|
+
</li>
|
1092
|
+
|
1093
|
+
</ul>
|
1094
|
+
|
1095
|
+
<p class="tag_title">Returns:</p>
|
1096
|
+
<ul class="return">
|
1097
|
+
|
1098
|
+
<li>
|
1099
|
+
|
1100
|
+
|
1101
|
+
<span class='type'></span>
|
1102
|
+
|
1103
|
+
|
1104
|
+
|
1105
|
+
|
1106
|
+
<div class='inline'>
|
1107
|
+
<p>true if the executable is not in a testing context.</p>
|
1108
|
+
</div>
|
1109
|
+
|
1110
|
+
</li>
|
1111
|
+
|
1112
|
+
</ul>
|
1113
|
+
|
1114
|
+
</div><table class="source_code">
|
1115
|
+
<tr>
|
1116
|
+
<td>
|
1117
|
+
<pre class="lines">
|
1118
|
+
|
1119
|
+
|
1120
|
+
26
|
1121
|
+
27
|
1122
|
+
28</pre>
|
1123
|
+
</td>
|
1124
|
+
<td>
|
1125
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 26</span>
|
1126
|
+
|
1127
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_should_validate'>should_validate</span><span class='lparen'>(</span><span class='id identifier rubyid_dest'>dest</span><span class='rparen'>)</span>
|
1128
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_dest'>dest</span><span class='period'>.</span><span class='id identifier rubyid_test_context?'>test_context?</span>
|
728
1129
|
<span class='kw'>end</span></pre>
|
729
1130
|
</td>
|
730
1131
|
</tr>
|
@@ -757,21 +1158,19 @@ href="help">your_task_name</a></p>
|
|
757
1158
|
<pre class="lines">
|
758
1159
|
|
759
1160
|
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
217</pre>
|
1161
|
+
108
|
1162
|
+
109
|
1163
|
+
110
|
1164
|
+
111
|
1165
|
+
112</pre>
|
766
1166
|
</td>
|
767
1167
|
<td>
|
768
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
1168
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 108</span>
|
769
1169
|
|
770
1170
|
<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
|
772
|
-
<span class='
|
773
|
-
|
774
|
-
<span class='kw'>end</span>
|
1171
|
+
<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_desc'>desc</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1172
|
+
<span class='id identifier rubyid_print_params'>print_params</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Input</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='ivar'>@input</span><span class='rparen'>)</span>
|
1173
|
+
<span class='id identifier rubyid_print_params'>print_params</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Output</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='ivar'>@output</span><span class='rparen'>)</span>
|
775
1174
|
<span class='kw'>end</span></pre>
|
776
1175
|
</td>
|
777
1176
|
</tr>
|
@@ -779,9 +1178,9 @@ href="help">your_task_name</a></p>
|
|
779
1178
|
</div>
|
780
1179
|
|
781
1180
|
<div class="method_details ">
|
782
|
-
<h3 class="signature " id="
|
1181
|
+
<h3 class="signature " id="validate_input-instance_method">
|
783
1182
|
|
784
|
-
- (<tt>Object</tt>) <strong>
|
1183
|
+
- (<tt>Object</tt>) <strong>validate_input</strong>(dest, args)
|
785
1184
|
|
786
1185
|
|
787
1186
|
|
@@ -825,31 +1224,33 @@ description.</p>
|
|
825
1224
|
<pre class="lines">
|
826
1225
|
|
827
1226
|
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
1227
|
+
32
|
1228
|
+
33
|
1229
|
+
34
|
1230
|
+
35
|
1231
|
+
36
|
1232
|
+
37
|
1233
|
+
38
|
1234
|
+
39
|
1235
|
+
40
|
1236
|
+
41
|
1237
|
+
42
|
1238
|
+
43
|
1239
|
+
44
|
1240
|
+
45
|
1241
|
+
46</pre>
|
842
1242
|
</td>
|
843
1243
|
<td>
|
844
|
-
<pre class="code"><span class="info file"># File 'lib/action_command.rb', line
|
1244
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/input_output.rb', line 32</span>
|
845
1245
|
|
846
|
-
<span class='kw'>def</span> <span class='id identifier
|
847
|
-
<span class='
|
1246
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_validate_input'>validate_input</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>
|
1247
|
+
<span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_should_validate'>should_validate</span><span class='lparen'>(</span><span class='id identifier rubyid_dest'>dest</span><span class='rparen'>)</span>
|
1248
|
+
<span class='ivar'>@input</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
1249
|
<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
|
-
|
1250
|
+
|
850
1251
|
<span class='comment'># if the argument has a value, no need to test whether it is optional.
|
851
1252
|
</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
|
-
|
1253
|
+
|
853
1254
|
<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
1255
|
<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
1256
|
<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>
|
@@ -867,7 +1268,7 @@ description.</p>
|
|
867
1268
|
</div>
|
868
1269
|
|
869
1270
|
<div id="footer">
|
870
|
-
Generated on
|
1271
|
+
Generated on Thu Mar 3 16:34:07 2016 by
|
871
1272
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
872
1273
|
0.8.7.6 (ruby-2.2.3).
|
873
1274
|
</div>
|