doc/Bovem/ShellMethods/Read.html in bovem-3.0.5 vs doc/Bovem/ShellMethods/Read.html in bovem-4.0.0

- old
+ new

@@ -4,22 +4,22 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Module: Bovem::ShellMethods::Read - &mdash; Documentation by YARD 0.8.7.3 + &mdash; Documentation by YARD 0.8.7.6 </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"> hasFrames = window.top.frames.main ? true : false; relpath = '../../'; - framesUrl = "../../frames.html#!" + escape(window.location.href); + framesUrl = "../../frames.html#!Bovem/ShellMethods/Read.html"; </script> <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> @@ -114,11 +114,11 @@ <ul class="summary"> <li class="public "> <span class="summary_signature"> - <a href="#check-instance_method" title="#check (instance method)">- (Object) <strong>check</strong>(path, tests) </a> + <a href="#check-instance_method" title="#check (instance method)">- (Object) <strong>check</strong>(path, *tests) </a> </span> @@ -137,11 +137,11 @@ <li class="public "> <span class="summary_signature"> - <a href="#find-instance_method" title="#find (instance method)">- (Object) <strong>find</strong>(directories, patterns = [], by_extension = false, case_sensitive = false, &amp;block) </a> + <a href="#find-instance_method" title="#find (instance method)">- (Object) <strong>find</strong>(directories, patterns: [], extension_only: false, case_sensitive: false, &amp;block) </a> </span> @@ -169,21 +169,22 @@ <div class="method_details first"> <h3 class="signature first" id="check-instance_method"> - - (<tt>Object</tt>) <strong>check</strong>(path, tests) + - (<tt>Object</tt>) <strong>check</strong>(path, *tests) </h3><div class="docstring"> <div class="discussion"> <p>Tests a path against a list of test.</p> -<p>Valid tests are every method available in http://www.ruby-doc.org/core-1.9.3/FileTest.html (plus <code>read</code>, <code>write</code>, <code>execute</code>, <code>exec</code>, <code>dir</code>). Trailing question mark can be omitted.</p> +<p>Valid tests are every method available in http://www.ruby-doc.org/core-2.3.0/FileTest.html (plus <code>read</code>, <code>write</code>, <code>execute</code>, <code>exec</code>, <code>dir</code>). + Trailing question mark can be omitted. Unrecognized tests will make the check fail.</p> </div> </div> <div class="tags"> @@ -227,73 +228,75 @@ <tr> <td> <pre class="lines"> +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 65 66 67 68 69 70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84</pre> +71</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 65</span> + <pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 51</span> -<span class='kw'>def</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_tests'>tests</span><span class='rparen'>)</span> +<span class='kw'>def</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_tests'>tests</span><span class='rparen'>)</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> - <span class='id identifier rubyid_tests'>tests</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_test'>test</span><span class='op'>|</span> + <span class='id identifier rubyid_tests'>tests</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='label'>no_duplicates:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>compact:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>flatten:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_test'>test</span><span class='op'>|</span> <span class='comment'># Adjust test name </span> <span class='id identifier rubyid_test'>test</span> <span class='op'>=</span> <span class='id identifier rubyid_test'>test</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> - <span class='id identifier rubyid_test'>test</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_test'>test</span> + <span class='id identifier rubyid_test'>test</span> <span class='op'>=</span> + <span class='kw'>case</span> <span class='id identifier rubyid_test'>test</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>read</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>readable</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>write</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>writable</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>execute</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>exec</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>executable</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>dir</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>directory</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>else</span> <span class='id identifier rubyid_test'>test</span> - <span class='kw'>end</span> + <span class='kw'>end</span> <span class='comment'># Execute test </span> <span class='id identifier rubyid_test'>test</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='kw'>if</span> <span class='id identifier rubyid_test'>test</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\?$</span><span class='regexp_end'>/</span></span> <span class='const'>FileTest</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_test'>test</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>FileTest</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_test'>test</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span> - <span class='rbrace'>}</span> + <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="find-instance_method"> - - (<tt>Object</tt>) <strong>find</strong>(directories, patterns = [], by_extension = false, case_sensitive = false, &amp;block) + - (<tt>Object</tt>) <strong>find</strong>(directories, patterns: [], extension_only: false, case_sensitive: false, &amp;block) </h3><div class="docstring"> <div class="discussion"> <p>Find a list of files in directories matching given regexps or patterns.</p> -<p>You can also pass a block to perform matching. The block will receive a single argument and the path will be considered matched if the blocks not evaluates to <code>nil</code> or <code>false</code>.</p> +<p>You can also pass a block to perform matching. The block will receive a single argument and the path will be considered if return value is not falsey.</p> <p>Inside the block, you can call <code>Find.prune</code> to stop searching in the current directory.</p> </div> @@ -323,30 +326,26 @@ <span class='type'>(<tt>Array</tt>)</span> - <em class="default">(defaults to: <tt>[]</tt>)</em> - &mdash; <div class='inline'><p>A list of regexps or patterns to match files. If empty, every file is returned. Ignored if a block is provided.</p> </div> </li> <li> - <span class='name'>by_extension</span> + <span class='name'>extension_only</span> <span class='type'>(<tt>Boolean</tt>)</span> - <em class="default">(defaults to: <tt>false</tt>)</em> - &mdash; <div class='inline'><p>If to only search in extensions. Ignored if a block is provided.</p> </div> </li> @@ -357,13 +356,11 @@ <span class='type'>(<tt>Boolean</tt>)</span> - <em class="default">(defaults to: <tt>false</tt>)</em> - &mdash; <div class='inline'><p>If the search is case sensitive. Only meaningful for string patterns.</p> </div> </li> @@ -390,45 +387,43 @@ <tr> <td> <pre class="lines"> +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 97 98 99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114</pre> +100</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 97</span> + <pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 84</span> -<span class='kw'>def</span> <span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_directories'>directories</span><span class='comma'>,</span> <span class='id identifier rubyid_patterns'>patterns</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_by_extension'>by_extension</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_case_sensitive'>case_sensitive</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> +<span class='kw'>def</span> <span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_directories'>directories</span><span class='comma'>,</span> <span class='label'>patterns:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>extension_only:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>case_sensitive:</span> <span class='kw'>false</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_rv'>rv</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> - <span class='id identifier rubyid_directories'>directories</span> <span class='op'>=</span> <span class='id identifier rubyid_directories'>directories</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_d'>d</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='rbrace'>}</span> - <span class='id identifier rubyid_patterns'>patterns</span> <span class='op'>=</span> <span class='id identifier rubyid_normalize_patterns'>normalize_patterns</span><span class='lparen'>(</span><span class='id identifier rubyid_patterns'>patterns</span><span class='comma'>,</span> <span class='id identifier rubyid_by_extension'>by_extension</span><span class='comma'>,</span> <span class='id identifier rubyid_case_sensitive'>case_sensitive</span><span class='rparen'>)</span> + <span class='id identifier rubyid_directories'>directories</span> <span class='op'>=</span> <span class='id identifier rubyid_directories'>directories</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='label'>no_duplicates:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>compact:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>flatten:</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_d'>d</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='rbrace'>}</span> + <span class='id identifier rubyid_patterns'>patterns</span> <span class='op'>=</span> <span class='id identifier rubyid_normalize_patterns'>normalize_patterns</span><span class='lparen'>(</span><span class='id identifier rubyid_patterns'>patterns</span><span class='comma'>,</span> <span class='id identifier rubyid_extension_only'>extension_only</span><span class='comma'>,</span> <span class='id identifier rubyid_case_sensitive'>case_sensitive</span><span class='rparen'>)</span> <span class='id identifier rubyid_directories'>directories</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_directory'>directory</span><span class='op'>|</span> - <span class='kw'>if</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='symbol'>:directory</span><span class='comma'>,</span> <span class='symbol'>:readable</span><span class='comma'>,</span> <span class='symbol'>:executable</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>then</span> - <span class='const'>Find</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_entry'>entry</span><span class='op'>|</span> - <span class='id identifier rubyid_found'>found</span> <span class='op'>=</span> <span class='id identifier rubyid_patterns'>patterns</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='id identifier rubyid_match_pattern'>match_pattern</span><span class='lparen'>(</span><span class='id identifier rubyid_entry'>entry</span><span class='comma'>,</span> <span class='id identifier rubyid_patterns'>patterns</span><span class='comma'>,</span> <span class='id identifier rubyid_by_extension'>by_extension</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> + <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='symbol'>:directory</span><span class='comma'>,</span> <span class='symbol'>:readable</span><span class='comma'>,</span> <span class='symbol'>:executable</span><span class='rbracket'>]</span><span class='rparen'>)</span> + <span class='const'>Find</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_entry'>entry</span><span class='op'>|</span> + <span class='id identifier rubyid_found'>found</span> <span class='op'>=</span> <span class='id identifier rubyid_patterns'>patterns</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='id identifier rubyid_match_pattern'>match_pattern</span><span class='lparen'>(</span><span class='id identifier rubyid_entry'>entry</span><span class='comma'>,</span> <span class='id identifier rubyid_patterns'>patterns</span><span class='comma'>,</span> <span class='id identifier rubyid_extension_only'>extension_only</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_rv'>rv</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_entry'>entry</span> <span class='kw'>if</span> <span class='id identifier rubyid_found'>found</span> - <span class='kw'>end</span> + <span class='id identifier rubyid_rv'>rv</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_entry'>entry</span> <span class='kw'>if</span> <span class='id identifier rubyid_found'>found</span> <span class='kw'>end</span> <span class='kw'>end</span> <span class='id identifier rubyid_rv'>rv</span> <span class='kw'>end</span></pre> @@ -440,12 +435,12 @@ </div> </div> <div id="footer"> - Generated on Sat Mar 8 10:27:42 2014 by + Generated on Tue Mar 29 20:43:16 2016 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.8.7.3 (ruby-2.1.0). + 0.8.7.6 (ruby-2.3.0). </div> </body> </html> \ No newline at end of file