340 lines
14 KiB
HTML
340 lines
14 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::FakeDir</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::FakeDir
|
|
|
|
<span class="parent"><
|
|
|
|
Hash
|
|
|
|
</span>
|
|
|
|
</h1>
|
|
<ul class="files">
|
|
|
|
<li><a href="../../files/lib/fakefs/fake/dir_rb.html">lib/fakefs/fake/dir.rb</a></li>
|
|
|
|
</ul>
|
|
</div>
|
|
<div id="bodyContent">
|
|
<div id="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sectiontitle">Methods</div>
|
|
<dl class="methods">
|
|
|
|
<dt>C</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000026">clone</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>D</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000028">delete</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>E</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000024">entry</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>I</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000025">inspect</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>N</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000023">new</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>T</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000027">to_s</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sectiontitle">Attributes</div>
|
|
<table border='0' cellpadding='5'>
|
|
|
|
<tr valign='top'>
|
|
<td class='attr-rw'>
|
|
[RW]
|
|
</td>
|
|
<td class='attr-name'>name</td>
|
|
<td class='attr-desc'></td>
|
|
</tr>
|
|
|
|
<tr valign='top'>
|
|
<td class='attr-rw'>
|
|
[RW]
|
|
</td>
|
|
<td class='attr-name'>parent</td>
|
|
<td class='attr-desc'></td>
|
|
</tr>
|
|
|
|
<tr valign='top'>
|
|
<td class='attr-rw'>
|
|
[R]
|
|
</td>
|
|
<td class='attr-name'>ctime</td>
|
|
<td class='attr-desc'></td>
|
|
</tr>
|
|
|
|
<tr valign='top'>
|
|
<td class='attr-rw'>
|
|
[R]
|
|
</td>
|
|
<td class='attr-name'>mtime</td>
|
|
<td class='attr-desc'></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="sectiontitle">Class Public methods</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000023">
|
|
|
|
<a name="M000023"></a><b>new</b>(name = nil, parent = nil)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000023_source')" id="l_M000023_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L6" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000023_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 6</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
|
|
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
|
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">parent</span>
|
|
<span class="ruby-ivar">@ctime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
|
<span class="ruby-ivar">@mtime</span> = <span class="ruby-ivar">@ctime</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="M000026">
|
|
|
|
<a name="M000026"></a><b>clone</b>(parent = nil)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L21" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000026_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 21</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clone</span>(<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>)
|
|
<span class="ruby-identifier">clone</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-keyword kw">self</span>))
|
|
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
|
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">clone</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span>
|
|
<span class="ruby-identifier">clone</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000028">
|
|
|
|
<a name="M000028"></a><b>delete</b>(node = self)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L40" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000028_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 40</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">node</span> = <span class="ruby-keyword kw">self</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
|
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>)
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">name</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="M000024">
|
|
|
|
<a name="M000024"></a><b>entry</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000024_source')" id="l_M000024_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L13" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000024_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 13</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entry</span>
|
|
<span class="ruby-keyword kw">self</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000025">
|
|
|
|
<a name="M000025"></a><b>inspect</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000025_source')" id="l_M000025_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L17" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000025_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 17</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
|
<span class="ruby-node">"(FakeDir name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{size})"</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000027">
|
|
|
|
<a name="M000027"></a><b>to_s</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000027_source')" id="l_M000027_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/8354db1b7729438cfd67a264bb8a46d822071bcf/lib/fakefs/fake/dir.rb#L30" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000027_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/fake/dir.rb, line 30</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'.'</span>
|
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">name</span>)
|
|
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">parent</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'.'</span>
|
|
<span class="ruby-node">"#{File::PATH_SEPARATOR}#{name}"</span>
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-identifier">name</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |