<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: File
  
    &mdash; Documentation by YARD 0.8.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '';
  framesUrl = "frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (F)</a> &raquo;
    
    
    <span class="title">File</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: File
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName"><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></span>
      
        <ul class="fullTree">
          <li><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></li>
          
            <li class="next">File</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/core_ext/file.rb<span class="defines">,<br />
  lib/applescripter.rb</span>
</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>Extensions to the core File class.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Author:</p>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>Martin Kopischke</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Version:</p>
<ul class="version">
  
    <li>
      
      
      
      
        
        <div class='inline'><p><span class='object_link'><a href="CoreExtensions.html#VERSION-constant" title="CoreExtensions::VERSION (constant)">CoreExtensions::VERSION</a></span></p>
</div>
      
    </li>
  
</ul>

</div>






  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#guess_encoding-class_method" title="guess_encoding (class method)">+ (Encoding<sup>?</sup>) <strong>guess_encoding</strong>(file, *guessers, **guess_options) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Guess the text content encoding of a file.</p>
</div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#expanded_path-instance_method" title="#expanded_path (instance method)">- (String) <strong>expanded_path</strong>(dir_string = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Get the expanded form of the path used to create the file.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#guess_encoding-instance_method" title="#guess_encoding (instance method)">- (Encoding<sup>?</sup>) <strong>guess_encoding</strong>(*guessers, **guess_options) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Guess the file's text content encoding.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_applescript-instance_method" title="#to_applescript (instance method)">- (String) <strong>to_applescript</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Convert to the String representation of an ApplesScript alias.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="guess_encoding-class_method">
  
    + (<tt><span class='object_link'><a href="Encoding.html" title="Encoding (class)">Encoding</a></span></tt><sup>?</sup>) <strong>guess_encoding</strong>(file, *guessers, **guess_options) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Guess the text content encoding of a file.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>file</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="File (class)">File</a></span></tt>, <tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the file whose encoding is to be guessed.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>guessers</span>
      
      
        <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="FileEncoding/Guesser.html" title="FileEncoding::Guesser (class)">FileEncoding::Guesser</a></span>&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the encoding guessers to use
(defaults to <span class='object_link'><a href="FileEncoding/Guessers.html#default_set-class_method" title="FileEncoding::Guessers.default_set (method)">FileEncoding::Guessers.default_set</a></span>).</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>guess_options</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>as in <span class='object_link'><a href="FileEncoding/GuesserQueue.html#initialize-instance_method" title="FileEncoding::GuesserQueue#initialize (method)">FileEncoding::GuesserQueue#initialize</a></span>.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Encoding.html" title="Encoding (class)">Encoding</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>if an encoding could be guessed.</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>if no encoding could be guessed or <code>file</code> is not an existing file.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


17
18
19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/core_ext/file.rb', line 17</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_guess_encoding'>guess_encoding</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_guessers'>guessers</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_guess_options'>guess_options</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_guessers'>guessers</span> <span class='op'>=</span> <span class='const'>FileEncoding</span><span class='op'>::</span><span class='const'>Guessers</span><span class='period'>.</span><span class='id identifier rubyid_default_set'>default_set</span> <span class='kw'>if</span> <span class='id identifier rubyid_guessers'>guessers</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
  <span class='id identifier rubyid_queue'>queue</span>    <span class='op'>=</span> <span class='const'>FileEncoding</span><span class='op'>::</span><span class='const'>GuesserQueue</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_guessers'>guessers</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_guess_options'>guess_options</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_process'>process</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_file?'>file?</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="expanded_path-instance_method">
  
    - (<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>) <strong>expanded_path</strong>(dir_string = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Get the expanded form of the path used to create the file.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>dir_string</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>as in File.expand_path.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the path.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/core_ext/file.rb', line 34</span>

<span class='kw'>def</span> <span class='id identifier rubyid_expanded_path'>expanded_path</span><span class='lparen'>(</span><span class='id identifier rubyid_dir_string'>dir_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_dir_string'>dir_string</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="guess_encoding-instance_method">
  
    - (<tt><span class='object_link'><a href="Encoding.html" title="Encoding (class)">Encoding</a></span></tt><sup>?</sup>) <strong>guess_encoding</strong>(*guessers, **guess_options) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Guess the file's text content encoding.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>guessers</span>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>as in <span class='object_link'><a href="#guess_encoding-class_method" title="File.guess_encoding (method)">guess_encoding</a></span>.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>guess_options</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>as in <span class='object_link'><a href="#guess_encoding-class_method" title="File.guess_encoding (method)">guess_encoding</a></span>.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Encoding.html" title="Encoding (class)">Encoding</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>if an encoding could be guessed.</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>if no encoding could be guessed or <code>file</code> is not an existing file.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


27
28
29</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/core_ext/file.rb', line 27</span>

<span class='kw'>def</span> <span class='id identifier rubyid_guess_encoding'>guess_encoding</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_guessers'>guessers</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_guess_options'>guess_options</span><span class='rparen'>)</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_guess_encoding'>guess_encoding</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_guessers'>guessers</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_guess_options'>guess_options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_applescript-instance_method">
  
    - (<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>) <strong>to_applescript</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'><p>AppleScript's <em>alias</em> objects need to exist, like Ruby's Files.</p>
</div>
  </div>

<p>Convert to the String representation of an ApplesScript alias.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>an AppleScript <em>alias</em> representation.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


142
143
144</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/applescripter.rb', line 142</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_applescript'>to_applescript</span>
  <span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_applescript'>to_applescript</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> as alias</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Thu Jan 16 03:48:23 2014 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.3 (ruby-2.0.0).
</div>

  </body>
</html>
