Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>By default, you already have access to <a href="http://www.ruby-doc.org/core/classes/Dir.html" rel="noreferrer">Dir</a> and <a href="http://www.ruby-doc.org/core/classes/File.html" rel="noreferrer">File</a>, which are pretty useful by themselves.</p> <pre><code>Dir['*.rb'] #basic globs Dir['**/*.rb'] #** == any depth of directory, including current dir. #=&gt; array of relative names File.expand_path('~/file.txt') #=&gt; "/User/mat/file.txt" File.dirname('dir/file.txt') #=&gt; 'dir' File.basename('dir/file.txt') #=&gt; 'file.txt' File.join('a', 'bunch', 'of', 'strings') #=&gt; 'a/bunch/of/strings' __FILE__ #=&gt; the name of the current file </code></pre> <p>Also useful from the stdlib is <a href="http://www.ruby-doc.org/stdlib/libdoc/fileutils/rdoc/index.html" rel="noreferrer">FileUtils</a></p> <pre><code>require 'fileutils' #I know, no underscore is not ruby-like include FileUtils # Gives you access (without prepending by 'FileUtils.') to cd(dir, options) cd(dir, options) {|dir| .... } pwd() mkdir(dir, options) mkdir(list, options) mkdir_p(dir, options) mkdir_p(list, options) rmdir(dir, options) rmdir(list, options) ln(old, new, options) ln(list, destdir, options) ln_s(old, new, options) ln_s(list, destdir, options) ln_sf(src, dest, options) cp(src, dest, options) cp(list, dir, options) cp_r(src, dest, options) cp_r(list, dir, options) mv(src, dest, options) mv(list, dir, options) rm(list, options) rm_r(list, options) rm_rf(list, options) install(src, dest, mode = &lt;src's&gt;, options) chmod(mode, list, options) chmod_R(mode, list, options) chown(user, group, list, options) chown_R(user, group, list, options) touch(list, options) </code></pre> <p>Which is pretty nice </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload