776 lines
36 KiB
HTML
776 lines
36 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<title>FakeFS::Dir</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
|
|
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
|
|
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="banner">
|
|
<h1>
|
|
<span class="type">Class</span>
|
|
FakeFS::Dir
|
|
|
|
<span class="parent"><
|
|
|
|
<a href="../Object.html">Object</a>
|
|
|
|
</span>
|
|
|
|
</h1>
|
|
<ul class="files">
|
|
|
|
<li><a href="../../files/lib/fakefs/dir_rb.html">lib/fakefs/dir.rb</a></li>
|
|
|
|
</ul>
|
|
</div>
|
|
<div id="bodyContent">
|
|
<div id="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sectiontitle">Methods</div>
|
|
<dl class="methods">
|
|
|
|
<dt>#</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000012">[]</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>C</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000013">chdir</a>,</li>
|
|
|
|
<li><a href="#M000014">chroot</a>,</li>
|
|
|
|
<li><a href="#M000003">close</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>D</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000015">delete</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>E</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000005">each</a>,</li>
|
|
|
|
<li><a href="#M000016">entries</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>F</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000017">foreach</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>G</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000018">glob</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>M</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000019">mkdir</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>N</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000002">new</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>O</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000020">open</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>P</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000006">path</a>,</li>
|
|
|
|
<li><a href="#M000007">pos</a>,</li>
|
|
|
|
<li><a href="#M000008">pos=</a>,</li>
|
|
|
|
<li><a href="#M000022">pwd</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>R</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000009">read</a>,</li>
|
|
|
|
<li><a href="#M000010">rewind</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>S</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000011">seek</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>T</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000021">tmpdir</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
<div class="sectiontitle">Included Modules</div>
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<span>Enumerable</span>
|
|
|
|
START:includes
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sectiontitle">Class Public methods</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000012">
|
|
|
|
<a name="M000012"></a><b>[]</b>(pattern)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L55" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000012_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 55</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]</span>(<span class="ruby-identifier">pattern</span>)
|
|
<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000013">
|
|
|
|
<a name="M000013"></a><b>chdir</b>(dir, &blk)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L59" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000013_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 59</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
|
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000014">
|
|
|
|
<a name="M000014"></a><b>chroot</b>(string)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L63" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000014_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 63</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">chroot</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-comment cmt"># Not implemented yet</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000015">
|
|
|
|
<a name="M000015"></a><b>delete</b>(string)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L67" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000015_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 67</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SystemCallError</span>, <span class="ruby-node">"No such file or directory - #{string}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">values</span>.<span class="ruby-identifier">empty?</span>
|
|
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000016">
|
|
|
|
<a name="M000016"></a><b>entries</b>(dirname)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L72" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000016_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 72</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-identifier">dirname</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">SystemCallError</span>, <span class="ruby-identifier">dirname</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dirname</span>)
|
|
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dirname</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">file</span>) }
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000017">
|
|
|
|
<a name="M000017"></a><b>foreach</b>(dirname, &block)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000017_source')" id="l_M000017_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L77" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000017_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 77</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">foreach</span>(<span class="ruby-identifier">dirname</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">dirname</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">file</span> }
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000018">
|
|
|
|
<a name="M000018"></a><b>glob</b>(pattern)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L81" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000018_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 81</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>)
|
|
[<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">pattern</span>) <span class="ruby-operator">||</span> []].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>}.<span class="ruby-identifier">sort</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000019">
|
|
|
|
<a name="M000019"></a><b>mkdir</b>(string, integer = 0)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L85" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000019_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 85</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">integer</span> = <span class="ruby-value">0</span>)
|
|
<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>)
|
|
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">pop</span>
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-node">"No such file or directory - #{string}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">join</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span> <span class="ruby-operator">||</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>))
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EEXIST</span>, <span class="ruby-node">"File exists - #{string}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000002">
|
|
|
|
<a name="M000002"></a><b>new</b>(string)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L5" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000002_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 5</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>, <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-ivar">@path</span> = <span class="ruby-identifier">string</span>
|
|
<span class="ruby-ivar">@open</span> = <span class="ruby-keyword kw">true</span>
|
|
<span class="ruby-ivar">@pointer</span> = <span class="ruby-value">0</span>
|
|
<span class="ruby-ivar">@contents</span> = [ <span class="ruby-value str">'.'</span>, <span class="ruby-value str">'..'</span>, ] <span class="ruby-operator">+</span> <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-ivar">@path</span>).<span class="ruby-identifier">values</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000020">
|
|
|
|
<a name="M000020"></a><b>open</b>(string, &block)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L93" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000020_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 93</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">string</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">file</span>) }
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-keyword kw">end</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000022">
|
|
|
|
<a name="M000022"></a><b>pwd</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000022_source')" id="l_M000022_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L105" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000022_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 105</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pwd</span>
|
|
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">current_dir</span>.<span class="ruby-identifier">to_s</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000021">
|
|
|
|
<a name="M000021"></a><b>tmpdir</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000021_source')" id="l_M000021_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L101" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000021_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 101</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tmpdir</span>
|
|
<span class="ruby-value str">'/tmp'</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="sectiontitle">Instance Public methods</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000003">
|
|
|
|
<a name="M000003"></a><b>close</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L13" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000003_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 13</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
|
|
<span class="ruby-ivar">@open</span> = <span class="ruby-keyword kw">false</span>
|
|
<span class="ruby-ivar">@pointer</span> = <span class="ruby-keyword kw">nil</span>
|
|
<span class="ruby-ivar">@contents</span> = <span class="ruby-keyword kw">nil</span>
|
|
<span class="ruby-keyword kw">nil</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000005">
|
|
|
|
<a name="M000005"></a><b>each</b>(&block)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L20" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000005_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 20</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">f</span> = <span class="ruby-identifier">read</span>
|
|
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">f</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000006">
|
|
|
|
<a name="M000006"></a><b>path</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L26" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000006_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 26</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>
|
|
<span class="ruby-ivar">@path</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000007">
|
|
|
|
<a name="M000007"></a><b>pos</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L30" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000007_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 30</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pos</span>
|
|
<span class="ruby-ivar">@pointer</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000008">
|
|
|
|
<a name="M000008"></a><b>pos=</b>(integer)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L34" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000008_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 34</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pos=</span>(<span class="ruby-identifier">integer</span>)
|
|
<span class="ruby-ivar">@pointer</span> = <span class="ruby-identifier">integer</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000009">
|
|
|
|
<a name="M000009"></a><b>read</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L38" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000009_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 38</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-value str">"closed directory"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pointer</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
|
<span class="ruby-identifier">n</span> = <span class="ruby-ivar">@contents</span>[<span class="ruby-ivar">@pointer</span>]
|
|
<span class="ruby-ivar">@pointer</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
|
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span>, <span class="ruby-value str">''</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000010">
|
|
|
|
<a name="M000010"></a><b>rewind</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000010_source')" id="l_M000010_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L45" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000010_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 45</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rewind</span>
|
|
<span class="ruby-ivar">@pointer</span> = <span class="ruby-value">0</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000011">
|
|
|
|
<a name="M000011"></a><b>seek</b>(integer)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bdb3fa4ac07c09143a97db73cccb47155d298aca/lib/fakefs/dir.rb#L49" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000011_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/dir.rb, line 49</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seek</span>(<span class="ruby-identifier">integer</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-value str">"closed directory"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pointer</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
|
<span class="ruby-ivar">@pointer</span> = <span class="ruby-identifier">integer</span>
|
|
<span class="ruby-ivar">@contents</span>[<span class="ruby-identifier">integer</span>]
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |