doc/rdoc/classes/RIO/Doc/HOWTO.html in rio-0.3.1 vs doc/rdoc/classes/RIO/Doc/HOWTO.html in rio-0.3.2

- old
+ new

@@ -159,11 +159,11 @@ <li>Read all lines starting with &#8216;require&#8217; into an array, with each line chomped <pre> # method 1 - array = ario.chomp.lines(/^\s*require/) + array = ario.chomp.lines[/^\s*require/] # method 2 ario.chomp.lines(/^\s*require/) &gt; array </pre> </li> <li>Read a gzipped file into a string @@ -264,11 +264,11 @@ # method 1 ario.puts(string) # method 2 ario.print(string) # method 3 - ario.noclose &lt; string + ario.noautoclose &lt; string </pre> </li> <li>Write a string to a file and close the file <pre> @@ -286,11 +286,11 @@ # method 1 ario.a.puts(string) # method 2 ario.a.print(string) # method 3 - ario.noclose &lt;&lt; string + ario.noautoclose &lt;&lt; string </pre> </li> <li>Append a string to a file and close the file <pre> @@ -307,11 +307,11 @@ <pre> # method 1 ario = rio('afile').nocloseoncopy ario &lt;&lt; array # method 2 - ario.noclose &lt; array + ario.noautoclose &lt; array </pre> </li> <li>Write an array to a file and close the file <pre> @@ -439,15 +439,19 @@ array = ario.entries('*.txt').norecurse('.svn').to_a # method 5 array = ario.norecurse('.svn')['*.txt'] </pre> </li> -<li>Iterate through all ruby files in a directory structure except those in the -&#8217;.svn&#8217; and &#8216;pkg&#8217; directories +<li>Iterate through ruby files in a directory and subdirectories skipping those +in the &#8217;.svn&#8217;, and &#8216;pkg&#8217; directories <pre> # method 1 - ario.norecurse('.svn','pkg').files('*.rb',proc{ |f| f.executable? and f[0] =~ /^#!.+ruby/ }) { |f| ... } + is_ruby_exe = proc{ |f| f.executable? and f[0][0] =~ /^#!.+ruby/ } + ario.norecurse('.svn','pkg').files('*.rb',is_ruby_exe) { |f| ... } + # method 2 + is_ruby_exe = proc{ |f| f.executable? and f.gets =~ /^#!.+ruby/ } + ario.norecurse('.svn','pkg').files('*.rb',is_ruby_exe) { |f| ... } </pre> </li> <li>Put all files excluding those that are symlinks to files in an array <pre> \ No newline at end of file