1218 lines
57 KiB
HTML
1218 lines
57 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::File</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::File
|
|
|
|
<span class="parent"><
|
|
|
|
<a href="../Object.html">Object</a>
|
|
|
|
</span>
|
|
|
|
</h1>
|
|
<ul class="files">
|
|
|
|
<li><a href="../../files/lib/fakefs/file_rb.html">lib/fakefs/file.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="#M000096"><<</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>B</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000067">basename</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>C</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000089">close</a>,</li>
|
|
|
|
<li><a href="#M000060">const_missing</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>D</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000078">delete</a>,</li>
|
|
|
|
<li><a href="#M000061">directory?</a>,</li>
|
|
|
|
<li><a href="#M000068">dirname</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>E</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000051">exist?</a>,</li>
|
|
|
|
<li><a href="#M000092">exists?</a>,</li>
|
|
|
|
<li><a href="#M000066">expand_path</a>,</li>
|
|
|
|
<li><a href="#M000049">extname</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>F</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000064">file?</a>,</li>
|
|
|
|
<li><a href="#M000097">flush</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>J</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000050">join</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>L</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000075">link</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>M</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000052">mtime</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>N</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000088">new</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>O</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000071">open</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>P</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000095">print</a>,</li>
|
|
|
|
<li><a href="#M000093">puts</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>R</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000090">read</a>,</li>
|
|
|
|
<li><a href="#M000072">read</a>,</li>
|
|
|
|
<li><a href="#M000074">readlines</a>,</li>
|
|
|
|
<li><a href="#M000069">readlink</a>,</li>
|
|
|
|
<li><a href="#M000091">rewind</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>S</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000098">seek</a>,</li>
|
|
|
|
<li><a href="#M000058">size</a>,</li>
|
|
|
|
<li><a href="#M000059">size?</a>,</li>
|
|
|
|
<li><a href="#M000082">stat</a>,</li>
|
|
|
|
<li><a href="#M000081">symlink</a>,</li>
|
|
|
|
<li><a href="#M000063">symlink?</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>W</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
<li><a href="#M000094">write</a></li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sectiontitle">Classes and Modules</div>
|
|
<ul>
|
|
|
|
<li><span class="type">CLASS</span> <a href="File/Stat.html">FakeFS::File::Stat</a></li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="sectiontitle">Constants</div>
|
|
<table border='0' cellpadding='5'>
|
|
|
|
<tr valign='top'>
|
|
<td class="attr-name">PATH_SEPARATOR</td>
|
|
<td>=</td>
|
|
<td class="attr-value">'/'</td>
|
|
</tr>
|
|
|
|
|
|
<tr valign='top'>
|
|
<td class="attr-name">MODES</td>
|
|
<td>=</td>
|
|
<td class="attr-value">[ READ_ONLY = "r", READ_WRITE = "r+", WRITE_ONLY = "w", READ_WRITE_TRUNCATE = "w+", APPEND_WRITE_ONLY = "a", APPEND_READ_WRITE = "a+" ]</td>
|
|
</tr>
|
|
|
|
|
|
<tr valign='top'>
|
|
<td class="attr-name">FILE_CREATION_MODES</td>
|
|
<td>=</td>
|
|
<td class="attr-value">MODES - [READ_ONLY, READ_WRITE]</td>
|
|
</tr>
|
|
|
|
|
|
<tr valign='top'>
|
|
<td class="attr-name">MODE_BITMASK</td>
|
|
<td>=</td>
|
|
<td class="attr-value">RealFile::RDONLY | RealFile::WRONLY | RealFile::RDWR | RealFile::APPEND | RealFile::CREAT | RealFile::EXCL | RealFile::NONBLOCK | RealFile::TRUNC | RealFile::NOCTTY | RealFile::SYNC</td>
|
|
</tr>
|
|
|
|
|
|
<tr valign='top'>
|
|
<td class="attr-name">FILE_CREATION_BITMASK</td>
|
|
<td>=</td>
|
|
<td class="attr-value">RealFile::CREAT</td>
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="sectiontitle">Attributes</div>
|
|
<table border='0' cellpadding='5'>
|
|
|
|
<tr valign='top'>
|
|
<td class='attr-rw'>
|
|
[R]
|
|
</td>
|
|
<td class='attr-name'>path</td>
|
|
<td class='attr-desc'></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="sectiontitle">Class Public methods</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000067">
|
|
|
|
<a name="M000067"></a><b>basename</b>(*args)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000067_source')" id="l_M000067_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L103" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000067_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 103</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
|
<span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000060">
|
|
|
|
<a name="M000060"></a><b>const_missing</b>(name)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000060_source')" id="l_M000060_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L69" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000060_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 69</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">const_missing</span>(<span class="ruby-identifier">name</span>)
|
|
<span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000078">
|
|
|
|
<a name="M000078"></a><b>delete</b>(file_name, *additional_file_names)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L157" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000078_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 157</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">file_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">additional_file_names</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">file_name</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 - #{file_name}"</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span>(<span class="ruby-identifier">file_name</span>)
|
|
|
|
<span class="ruby-identifier">additional_file_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file_name</span><span class="ruby-operator">|</span>
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span>(<span class="ruby-identifier">file_name</span>)
|
|
<span class="ruby-keyword kw">end</span>
|
|
|
|
<span class="ruby-identifier">additional_file_names</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000061">
|
|
|
|
<a name="M000061"></a><b>directory?</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000061_source')" id="l_M000061_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L73" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000061_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 73</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:entry</span>
|
|
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">FakeDir</span>
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-identifier">result</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">result</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">FakeDir</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</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="M000068">
|
|
|
|
<a name="M000068"></a><b>dirname</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000068_source')" id="l_M000068_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L107" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000068_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 107</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000051">
|
|
|
|
<a name="M000051"></a><b>exist?</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000051_source')" id="l_M000051_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L37" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000051_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 37</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000066">
|
|
|
|
<a name="M000066"></a><b>expand_path</b>(*args)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000066_source')" id="l_M000066_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L99" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000066_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 99</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
|
<span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000049">
|
|
|
|
<a name="M000049"></a><b>extname</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000049_source')" id="l_M000049_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L29" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000049_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 29</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-constant">RealFile</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000064">
|
|
|
|
<a name="M000064"></a><b>file?</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L90" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000064_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 90</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:entry</span>
|
|
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">FakeFile</span>
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-identifier">result</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-identifier">result</span> <span class="ruby-value">? </span><span class="ruby-identifier">result</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">FakeFile</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</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="M000050">
|
|
|
|
<a name="M000050"></a><b>join</b>(*parts)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L33" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000050_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 33</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">join</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">parts</span>)
|
|
<span class="ruby-identifier">parts</span> <span class="ruby-operator">*</span> <span class="ruby-constant">PATH_SEPARATOR</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000075">
|
|
|
|
<a name="M000075"></a><b>link</b>(source, dest)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L137" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000075_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 137</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">link</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">dest</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">source</span>)
|
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>, <span class="ruby-node">"Operation not permitted - #{source} or #{dest}"</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">source</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 - #{source} or #{dest}"</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">dest</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 - #{source} or #{dest}"</span>
|
|
<span class="ruby-keyword kw">end</span>
|
|
|
|
<span class="ruby-identifier">source</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">source</span>)
|
|
<span class="ruby-identifier">dest</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">dest</span>, <span class="ruby-identifier">source</span>.<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">clone</span>)
|
|
<span class="ruby-identifier">source</span>.<span class="ruby-identifier">link</span>(<span class="ruby-identifier">dest</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="M000052">
|
|
|
|
<a name="M000052"></a><b>mtime</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L49" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000052_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 49</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">mtime</span>
|
|
<span class="ruby-keyword kw">else</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-keyword kw">end</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000088">
|
|
|
|
<a name="M000088"></a><b>new</b>(path, mode = READ_ONLY, perm = nil)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000088_source')" id="l_M000088_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L207" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000088_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 207</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-constant">READ_ONLY</span>, <span class="ruby-identifier">perm</span> = <span class="ruby-keyword kw">nil</span>)
|
|
<span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
|
|
<span class="ruby-ivar">@mode</span> = <span class="ruby-identifier">mode</span>
|
|
<span class="ruby-ivar">@file</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-ivar">@open</span> = <span class="ruby-keyword kw">true</span>
|
|
|
|
<span class="ruby-identifier">check_modes!</span>
|
|
|
|
<span class="ruby-identifier">file_creation_mode?</span> <span class="ruby-value">? </span><span class="ruby-identifier">create_missing_file</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">check_file_existence!</span>
|
|
|
|
<span class="ruby-ivar">@stream</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@file</span>.<span class="ruby-identifier">content</span>, <span class="ruby-identifier">mode</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000071">
|
|
|
|
<a name="M000071"></a><b>open</b>(path, mode=READ_ONLY, perm = 0644)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000071_source')" id="l_M000071_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L116" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000071_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 116</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">path</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-constant">READ_ONLY</span>, <span class="ruby-identifier">perm</span> = <span class="ruby-value">0644</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">perm</span>)
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">perm</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="M000072">
|
|
|
|
<a name="M000072"></a><b>read</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L124" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000072_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 124</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-identifier">file</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">exists?</span>
|
|
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">read</span>
|
|
<span class="ruby-keyword kw">else</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-keyword kw">end</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000074">
|
|
|
|
<a name="M000074"></a><b>readlines</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L133" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000074_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 133</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">"\n"</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000069">
|
|
|
|
<a name="M000069"></a><b>readlink</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000069_source')" id="l_M000069_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L111" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000069_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 111</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">readlink</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-identifier">symlink</span> = <span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">symlink</span>.<span class="ruby-identifier">target</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="M000058">
|
|
|
|
<a name="M000058"></a><b>size</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L57" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000058_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 57</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">size</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">length</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000059">
|
|
|
|
<a name="M000059"></a><b>size?</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000059_source')" id="l_M000059_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L61" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000059_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 61</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">size?</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">size</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">zero?</span>
|
|
<span class="ruby-keyword kw">true</span>
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-keyword kw">nil</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="M000082">
|
|
|
|
<a name="M000082"></a><b>stat</b>(file)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L179" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000082_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 179</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">file</span>)
|
|
<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">Stat</span>.<span class="ruby-identifier">new</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="M000081">
|
|
|
|
<a name="M000081"></a><b>symlink</b>(source, dest)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L175" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000081_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 175</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">symlink</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">dest</span>)
|
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">ln_s</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">dest</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000063">
|
|
|
|
<a name="M000063"></a><b>symlink?</b>(path)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000063_source')" id="l_M000063_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L82" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000063_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 82</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-identifier">path</span>)
|
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:entry</span>
|
|
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">FakeSymlink</span>
|
|
<span class="ruby-keyword kw">else</span>
|
|
<span class="ruby-constant">FileSystem</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">FakeSymlink</span>
|
|
<span class="ruby-keyword kw">end</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="M000096">
|
|
|
|
<a name="M000096"></a><b><<</b>(content)
|
|
|
|
</div>
|
|
|
|
<div class="description">
|
|
<p>
|
|
Alias for <a href="File.html#M000094">write</a>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000089">
|
|
|
|
<a name="M000089"></a><b>close</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000089_source')" id="l_M000089_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L220" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000089_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 220</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-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000092">
|
|
|
|
<a name="M000092"></a><b>exists?</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000092_source')" id="l_M000092_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L232" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000092_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 232</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exists?</span>
|
|
<span class="ruby-keyword kw">true</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000097">
|
|
|
|
<a name="M000097"></a><b>flush</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000097_source')" id="l_M000097_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L246" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000097_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 246</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flush</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="M000095">
|
|
|
|
<a name="M000095"></a><b>print</b>(content)
|
|
|
|
</div>
|
|
|
|
<div class="description">
|
|
<p>
|
|
Alias for <a href="File.html#M000094">write</a>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000093">
|
|
|
|
<a name="M000093"></a><b>puts</b>(*content)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000093_source')" id="l_M000093_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L236" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000093_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 236</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">puts</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">content</span>)
|
|
<span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">content</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000090">
|
|
|
|
<a name="M000090"></a><b>read</b>(chunk = nil)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000090_source')" id="l_M000090_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L224" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000090_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 224</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">chunk</span> = <span class="ruby-keyword kw">nil</span>)
|
|
<span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">chunk</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000091">
|
|
|
|
<a name="M000091"></a><b>rewind</b>()
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000091_source')" id="l_M000091_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L228" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000091_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 228</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rewind</span>
|
|
<span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">rewind</span>
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000098">
|
|
|
|
<a name="M000098"></a><b>seek</b>(amount, whence = SEEK_SET)
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000098_source')" id="l_M000098_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L248" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000098_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 248</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seek</span>(<span class="ruby-identifier">amount</span>, <span class="ruby-identifier">whence</span> = <span class="ruby-constant">SEEK_SET</span>)
|
|
<span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">seek</span>(<span class="ruby-identifier">amount</span>, <span class="ruby-identifier">whence</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title" id="M000094">
|
|
|
|
<a name="M000094"></a><b>write</b>(content)
|
|
|
|
</div>
|
|
|
|
|
|
<div class="aka">
|
|
This method is also aliased as
|
|
|
|
<a href="File.html#M000095">print</a>
|
|
|
|
<a href="File.html#M000096"><<</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
<p class="source-link">
|
|
Source: <a href="javascript:toggleSource('M000094_source')" id="l_M000094_source">show</a>
|
|
|
|
| <a href="http://github.com/defunkt/fakefs/blob/bfffa910e9a8d5caf1628d7707ef19b7c4e5e1f0/lib/fakefs/file.rb#L240" target="_blank" class="github_url">on GitHub</a>
|
|
|
|
</p>
|
|
<div id="M000094_source" class="dyn-source">
|
|
<pre><span class="ruby-comment cmt"># File lib/fakefs/file.rb, line 240</span>
|
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">content</span>)
|
|
<span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">content</span>)
|
|
<span class="ruby-keyword kw">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |