ShogunPanda/bovem

View on GitHub
docs/Bovem/Command.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: Bovem::Command
  
    &mdash; Documentation by YARD 0.9.7
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  pathId = "Bovem::Command";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (C)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span>
     &raquo; 
    <span class="title">Command</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Class: Bovem::Command
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Bovem::Command</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  <dl>
      <dt>Includes:</dt>
      <dd><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Bovem::CommandMethods::Children</a></span>, <span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Bovem::CommandMethods::Help</a></span></dd>
  </dl>
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/bovem/command.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>This class represent a command (action) for Bovem.</p>

<p>Every command has the execution block and a set of option. Optionally, it also has before and after hooks.</p>


  </div>
</div>
<div class="tags">
  

</div><div id="subclasses">
  <h2>Direct Known Subclasses</h2>
  <p class="children"><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></p>
</div>




  <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#action-instance_method" title="#action (instance method)">#<strong>action</strong>(method = nil, &amp;hook)  &#x21d2; Proc|Symbol|NilClass </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reads and optionally sets the action of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#after-instance_method" title="#after (instance method)">#<strong>after</strong>(method = nil, &amp;hook)  &#x21d2; Proc|Symbol|NilClass </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Sets the after hook, that is a block executed after the action of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#application-instance_method" title="#application (instance method)">#<strong>application</strong>  &#x21d2; Application </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the application this command belongs to.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#arguments-instance_method" title="#arguments (instance method)">#<strong>arguments</strong>  &#x21d2; Array </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The arguments provided to this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#banner-instance_method" title="#banner (instance method)">#<strong>banner</strong>(value = nil)  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reads and optionally sets the description of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#before-instance_method" title="#before (instance method)">#<strong>before</strong>(method = nil, &amp;hook)  &#x21d2; Proc|Symbol|NilClass </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reads and optionally sets the before hook, that is a block executed before the action of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#commands-instance_method" title="#commands (instance method)">#<strong>commands</strong>  &#x21d2; Array </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The subcommands associated to this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#description-instance_method" title="#description (instance method)">#<strong>description</strong>(value = nil)  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reads and optionally sets the short description of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#i18n-instance_method" title="#i18n (instance method)">#<strong>i18n</strong>  &#x21d2; I18n </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A i18n helper.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong>(value = nil)  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reads and optionally sets the name of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#options-instance_method" title="#options (instance method)">#<strong>options</strong>  &#x21d2; Array </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The options available for this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#parent-instance_method" title="#parent (instance method)">#<strong>parent</strong>  &#x21d2; Command </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The parent of this command.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#synopsis-instance_method" title="#synopsis (instance method)">#<strong>synopsis</strong>(value = nil)  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Reads and optionally sets the synopsis of this command.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#application%3F-instance_method" title="#application? (instance method)">#<strong>application?</strong>  &#x21d2; Boolean </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Checks if the command is an application.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#banner%3F-instance_method" title="#banner? (instance method)">#<strong>banner?</strong>  &#x21d2; Boolean </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Check if this command has a banner.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#description%3F-instance_method" title="#description? (instance method)">#<strong>description?</strong>  &#x21d2; Boolean </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Check if this command has a description.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(args)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Executes this command, running its action or a subcommand.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#full_name-instance_method" title="#full_name (instance method)">#<strong>full_name</strong>(suffix = nil, separator = &quot;:&quot;)  &#x21d2; String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Gets a full name, that is the name of this command and its ancestor.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options = {}, &amp;block)  &#x21d2; Command </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Creates a new command.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#setup_with-instance_method" title="#setup_with (instance method)">#<strong>setup_with</strong>(options = {})  &#x21d2; Command </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setups the command.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Bovem::CommandMethods::Children</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="CommandMethods/Children.html#argument-instance_method" title="Bovem::CommandMethods::Children#argument (method)">#argument</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#clear_commands-instance_method" title="Bovem::CommandMethods::Children#clear_commands (method)">#clear_commands</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#clear_options-instance_method" title="Bovem::CommandMethods::Children#clear_options (method)">#clear_options</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#command-instance_method" title="Bovem::CommandMethods::Children#command (method)">#command</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#commands%3F-instance_method" title="Bovem::CommandMethods::Children#commands? (method)">#commands?</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#get_options-instance_method" title="Bovem::CommandMethods::Children#get_options (method)">#get_options</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#option-instance_method" title="Bovem::CommandMethods::Children#option (method)">#option</a></span>, <span class='object_link'><a href="CommandMethods/Children.html#options%3F-instance_method" title="Bovem::CommandMethods::Children#options? (method)">#options?</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Bovem::CommandMethods::Help</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="CommandMethods/Help.html#show_help-instance_method" title="Bovem::CommandMethods::Help#show_help (method)">#show_help</a></span></p>
<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    #<strong>initialize</strong>(options = {}, &amp;block)  &#x21d2; <tt><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Creates a new command.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The settings to initialize the command with.</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


327
328
329
330</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 327</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id="action=-instance_method"></span>
      <div class="method_details first">
  <h3 class="signature first" id="action-instance_method">
  
    #<strong>action</strong>(method = nil, &amp;hook)  &#x21d2; <tt>Proc|Symbol|NilClass</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Reads and optionally sets the action of this command.</p>

<p>A command action is only executed if no subcommand is executed.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>method</span>
      
      
        <span class='type'>(<tt>String|Symbol|NilClass</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The method of the application to hookup.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>hook</span>
      
      
        <span class='type'>(<tt>Proc</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The block to hookup if method is not provided.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Proc|Symbol|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The action of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="after=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="after-instance_method">
  
    #<strong>after</strong>(method = nil, &amp;hook)  &#x21d2; <tt>Proc|Symbol|NilClass</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Sets the after hook, that is a block executed after the action of this command.</p>

<p>This hook is only executed if no subcommand is executed.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>method</span>
      
      
        <span class='type'>(<tt>String|Symbol|NilClass</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The method of the application to hookup.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>hook</span>
      
      
        <span class='type'>(<tt>Proc</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The block to hookup if method is not provided.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Proc|Symbol|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The after hook of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="application=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="application-instance_method">
  
    #<strong>application</strong>  &#x21d2; <tt><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the application this command belongs to.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The application this command belongs to or <code>self</code>, if the command is an Application.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="arguments-instance_method">
  
    #<strong>arguments</strong>  &#x21d2; <tt>Array</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns The arguments provided to this command.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The arguments provided to this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="banner=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="banner-instance_method">
  
    #<strong>banner</strong>(value = nil)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Reads and optionally sets the description of this command.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>value</span>
      
      
        <span class='type'>(<tt>NilClass|Object</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The new description of this command.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The description of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="before=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="before-instance_method">
  
    #<strong>before</strong>(method = nil, &amp;hook)  &#x21d2; <tt>Proc|Symbol|NilClass</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Reads and optionally sets the before hook, that is a block executed before the action of this command.</p>

<p>This hook is only executed if no subcommand is executed.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>method</span>
      
      
        <span class='type'>(<tt>String|Symbol|NilClass</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The method of the application to hookup.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>hook</span>
      
      
        <span class='type'>(<tt>Proc</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The block to hookup if method is not provided.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Proc|Symbol|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The before hook of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="commands-instance_method">
  
    #<strong>commands</strong>  &#x21d2; <tt>Array</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns The subcommands associated to this command.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The subcommands associated to this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="description=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="description-instance_method">
  
    #<strong>description</strong>(value = nil)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Reads and optionally sets the short description of this command.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>value</span>
      
      
        <span class='type'>(<tt>NilClass|Object</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The new short description of this command.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The short description of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="i18n-instance_method">
  
    #<strong>i18n</strong>  &#x21d2; <tt><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns A i18n helper.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>A i18n helper.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="name=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="name-instance_method">
  
    #<strong>name</strong>(value = nil)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Reads and optionally sets the name of this command.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>value</span>
      
      
        <span class='type'>(<tt>NilClass|Object</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The new name of this command.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The name of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="options-instance_method">
  
    #<strong>options</strong>  &#x21d2; <tt>Array</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns The options available for this command.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The options available for this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="parent=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="parent-instance_method">
  
    #<strong>parent</strong>  &#x21d2; <tt><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns The parent of this command.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The parent of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="synopsis=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="synopsis-instance_method">
  
    #<strong>synopsis</strong>(value = nil)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Reads and optionally sets the synopsis of this command.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>value</span>
      
      
        <span class='type'>(<tt>NilClass|Object</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The new synopsis of this command.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The synopsis of this command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 309</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:description</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:banner</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:synopsis</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:before</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:action</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:after</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:application</span>
  <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:parent</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n</span>

  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Help.html" title="Bovem::CommandMethods::Help (module)">Help</a></span></span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods.html" title="Bovem::CommandMethods (module)">CommandMethods</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="CommandMethods/Children.html" title="Bovem::CommandMethods::Children (module)">Children</a></span></span>

  <span class='comment'># Creates a new command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings to initialize the command with.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the name of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new name of this command.
</span>  <span class='comment'># @return [String] The name of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@name</span>
  <span class='kw'>end</span>

  <span class='comment'># Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix
</span>  <span class='comment'>#
</span>  <span class='comment'># @param suffix [String] A suffix to append.
</span>  <span class='comment'># @param separator [String] The separator to use for components.
</span>  <span class='comment'># @return [String] The full name.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the short description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new short description of this command.
</span>  <span class='comment'># @return [String] The short description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description'>description</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@description</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@description</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the description of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new description of this command.
</span>  <span class='comment'># @return [String] The description of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@banner</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@banner</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the synopsis of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param value [NilClass|Object] The new synopsis of this command.
</span>  <span class='comment'># @return [String] The synopsis of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_synopsis'>synopsis</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='ivar'>@synopsis</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@synopsis</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the before hook, that is a block executed before the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The before hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_before'>before</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@before</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@before</span>
  <span class='kw'>end</span>

  <span class='comment'># Reads and optionally sets the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># A command action is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The action of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@action</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@action</span>
  <span class='kw'>end</span>

  <span class='comment'># Sets the after hook, that is a block executed after the action of this command.
</span>  <span class='comment'>#
</span>  <span class='comment'># This hook is only executed if no subcommand is executed.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param method [String|Symbol|NilClass] The method of the application to hookup.
</span>  <span class='comment'># @param hook [Proc] The block to hookup if method is not provided.
</span>  <span class='comment'># @return [Proc|Symbol|NilClass] The after hook of this command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_after'>after</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='ivar'>@after</span> <span class='op'>=</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='ivar'>@after</span>
  <span class='kw'>end</span>

  <span class='comment'># Returns the application this command belongs to.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Application] The application this command belongs to or `self`, if the command is an Application.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application'>application</span>
    <span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='ivar'>@application</span>
  <span class='kw'>end</span>

  <span class='comment'># Checks if the command is an application.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if command is an application, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
    <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a description.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a description, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
    <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Check if this command has a banner.
</span>  <span class='comment'>#
</span>  <span class='comment'># @return [Boolean] `true` if this command has a banner, `false` otherwise.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
    <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the command.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param options [Hash] The settings for this command.
</span>  <span class='comment'># @return [Command] The command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

    <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
      <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

      <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
        <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>

    <span class='kw'>self</span>
  <span class='kw'>end</span>

  <span class='comment'># Executes this command, running its action or a subcommand.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param args [Array] The arguments to pass to the command.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>      <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>      <span class='comment'># Run the before hook
</span>      <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='kw'>else</span> <span class='comment'># Show the help
</span>      <span class='id identifier rubyid_show_help'>show_help</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="I18n.html" title="Bovem::I18n (class)">I18n</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>root:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bovem.application</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html#LOCALE_ROOT-constant" title="Bovem::Application::LOCALE_ROOT (constant)">LOCALE_ROOT</a></span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_assign_hook'>assign_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='kw'>nil</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>=</span> <span class='id identifier rubyid_hook'>hook</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_assigned'>assigned</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>==</span> <span class='int'>1</span>
    <span class='id identifier rubyid_assigned'>assigned</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hook'>hook</span>
    <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_hook'>hook</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_hook'>hook</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_perform_action'>perform_action</span>
    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_before'>before</span><span class='rparen'>)</span>

    <span class='comment'># Run the action
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>

    <span class='comment'># Run the after hook
</span>    <span class='id identifier rubyid_execute_hook'>execute_hook</span><span class='lparen'>(</span><span class='id identifier rubyid_after'>after</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="application?-instance_method">
  
    #<strong>application?</strong>  &#x21d2; <tt>Boolean</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Checks if the command is an application.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p><code>true</code> if command is an application, <code>false</code> otherwise.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


424
425
426</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 424</span>

<span class='kw'>def</span> <span class='id identifier rubyid_application?'>application?</span>
  <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Application.html" title="Bovem::Application (class)">Application</a></span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="banner?-instance_method">
  
    #<strong>banner?</strong>  &#x21d2; <tt>Boolean</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Check if this command has a banner.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p><code>true</code> if this command has a banner, <code>false</code> otherwise.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


438
439
440</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 438</span>

<span class='kw'>def</span> <span class='id identifier rubyid_banner?'>banner?</span>
  <span class='id identifier rubyid_banner'>banner</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="description?-instance_method">
  
    #<strong>description?</strong>  &#x21d2; <tt>Boolean</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Check if this command has a description.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p><code>true</code> if this command has a description, <code>false</code> otherwise.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


431
432
433</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 431</span>

<span class='kw'>def</span> <span class='id identifier rubyid_description?'>description?</span>
  <span class='id identifier rubyid_description'>description</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="execute-instance_method">
  
    #<strong>execute</strong>(args)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Executes this command, running its action or a subcommand.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>args</span>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The arguments to pass to the command.</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


466
467
468
469
470
471
472
473
474
475
476
477</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 466</span>

<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_subcommand'>subcommand</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Bovem.html" title="Bovem (module)">Bovem</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Parser.html" title="Bovem::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="Parser.html#parse-instance_method" title="Bovem::Parser#parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>

  <span class='kw'>if</span> <span class='id identifier rubyid_subcommand'>subcommand</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># We have a subcommand to call
</span>    <span class='id identifier rubyid_commands'>commands</span><span class='lbracket'>[</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_subcommand'>subcommand</span><span class='lbracket'>[</span><span class='symbol'>:args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='comment'># Run our action
</span>    <span class='comment'># Run the before hook
</span>    <span class='id identifier rubyid_perform_action'>perform_action</span>
  <span class='kw'>else</span> <span class='comment'># Show the help
</span>    <span class='id identifier rubyid_show_help'>show_help</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="full_name-instance_method">
  
    #<strong>full_name</strong>(suffix = nil, separator = &quot;:&quot;)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Gets a full name, that is the name of this command and its ancestor. Optionally it also appends a suffix</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>suffix</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>A suffix to append.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>separator</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>&quot;:&quot;</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The separator to use for components.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The full name.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


346
347
348
349</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 346</span>

<span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_application?'>application?</span>
  <span class='lbracket'>[</span><span class='ivar'>@parent</span> <span class='op'>?</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_full_name'>full_name</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>!</span><span class='id identifier rubyid_application?'>application?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="setup_with-instance_method">
  
    #<strong>setup_with</strong>(options = {})  &#x21d2; <tt><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setups the command.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The settings for this command.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Bovem::Command (class)">Command</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The command.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bovem/command.rb', line 446</span>

<span class='kw'>def</span> <span class='id identifier rubyid_setup_with'>setup_with</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_setup_i18n'>setup_i18n</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>

  <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_option'>option</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
    <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_option'>option</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>

    <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span> <span class='op'>!=</span> <span class='int'>0</span>
      <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
    <span class='kw'>elsif</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
      <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='kw'>self</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Thu Jan 12 16:11:00 2017 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.7 (ruby-2.3.0).
</div>

    </div>
  </body>
</html>