Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bc75e49382dc9b94ff02ee45f6438cf2 > files > 105

ruby-actionmailer-2.3.4-1mdv2010.0.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!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>Class: TMail::Address</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">TMail::Address</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/action_mailer/vendor/tmail-1_2_3/tmail/address_rb.html">
                lib/action_mailer/vendor/tmail-1.2.3/tmail/address.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <h1>Class <a href="Address.html">Address</a></h1>
<p>
Provides a complete handling library for email addresses. Can <a
href="Address.html#M000267">parse</a> a string of an <a
href="Address.html#M000275">address</a> directly or take in preformatted
addresses themselves. Allows you to add and remove phrases from the front
of the <a href="Address.html#M000275">address</a> and provides a compare
function for email addresses.
</p>
<h2>Parsing and Handling a Valid <a href="Address.html">Address</a>:</h2>
<p>
Just pass the email <a href="Address.html#M000275">address</a> in as a
string to <a href="Address.html#M000267">Address.parse</a>:
</p>
<pre>
 email = TMail::Address.parse('Mikel Lindsaar &lt;mikel@lindsaar.net&gt;)
 #=&gt; #&lt;TMail::Address mikel@lindsaar.net&gt;
 email.address
 #=&gt; &quot;mikel@lindsaar.net&quot;
 email.local
 #=&gt; &quot;mikel&quot;
 email.domain
 #=&gt; &quot;lindsaar.net&quot;
 email.name             # Aliased as phrase as well
 #=&gt; &quot;Mikel Lindsaar&quot;
</pre>
<h2>Detecting an Invalid <a href="Address.html">Address</a></h2>
<p>
If you want to check the syntactical validity of an email <a
href="Address.html#M000275">address</a>, just pass it to <a
href="Address.html#M000267">Address.parse</a> and catch any <a
href="SyntaxError.html">SyntaxError</a>:
</p>
<pre>
 begin
   TMail::Mail.parse(&quot;mikel   2@@@@@ me .com&quot;)
 rescue TMail::SyntaxError
   puts(&quot;Invalid Email Address Detected&quot;)
 else
   puts(&quot;Address is valid&quot;)
 end
 #=&gt; &quot;Invalid Email Address Detected&quot;
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000276">==</a>&nbsp;&nbsp;
      <a href="#M000275">address</a>&nbsp;&nbsp;
      <a href="#M000273">domain</a>&nbsp;&nbsp;
      <a href="#M000279">dup</a>&nbsp;&nbsp;
      <a href="#M000277">eql?</a>&nbsp;&nbsp;
      <a href="#M000278">hash</a>&nbsp;&nbsp;
      <a href="#M000272">local</a>&nbsp;&nbsp;
      <a href="#M000269">name</a>&nbsp;&nbsp;
      <a href="#M000270">name=</a>&nbsp;&nbsp;
      <a href="#M000268">new</a>&nbsp;&nbsp;
      <a href="#M000267">parse</a>&nbsp;&nbsp;
      <a href="#M000271">routes</a>&nbsp;&nbsp;
      <a href="#M000274">spec</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="TextUtils.html">TextUtils</a></span>
        <span class="include-name">StrategyInterface</span>
      </div>
    </div>

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000268" class="method-detail">
        <a name="M000268"></a>

        <div class="method-heading">
          <a href="Address.src/M000268.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000268.html');return false;">
          <span class="method-name">new</span><span class="method-args">( local, domain )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="Address.html#M000268">Address.new</a>(<a
href="Address.html#M000272">local</a>, <a
href="Address.html#M000273">domain</a>)
</p>
<p>
Accepts:
</p>
<ul>
<li><a href="Address.html#M000272">local</a> - Left of the at symbol

</li>
<li><a href="Address.html#M000273">domain</a> - Array of the <a
href="Address.html#M000273">domain</a> split at the periods.

</li>
</ul>
<p>
For example:
</p>
<pre>
 Address.new(&quot;mikel&quot;, [&quot;lindsaar&quot;, &quot;net&quot;])
 #=&gt; &quot;#&lt;TMail::Address mikel@lindsaar.net&gt;&quot;
</pre>
        </div>
      </div>

      <div id="method-M000267" class="method-detail">
        <a name="M000267"></a>

        <div class="method-heading">
          <a href="Address.src/M000267.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000267.html');return false;">
          <span class="method-name">parse</span><span class="method-args">( str )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sometimes you need to <a href="Address.html#M000267">parse</a> an <a
href="Address.html#M000275">address</a>, <a href="../TMail.html">TMail</a>
can do it for you and provide you with a fairly robust method of detecting
a valid <a href="Address.html#M000275">address</a>.
</p>
<p>
Takes in a string, returns a <a href="Address.html">TMail::Address</a>
object.
</p>
<p>
Raises a <a href="SyntaxError.html">TMail::SyntaxError</a> on invalid email
format
</p>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000276" class="method-detail">
        <a name="M000276"></a>

        <div class="method-heading">
          <a href="Address.src/M000276.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000276.html');return false;">
          <span class="method-name">==</span><span class="method-args">( other )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Provides == function to the email. Only checks the actual <a
href="Address.html#M000275">address</a> and ignores the name/phrase
component
</p>
<p>
For Example
</p>
<pre>
 addr1 = TMail::Address.parse(&quot;My Address &lt;mikel@lindsaar.net&gt;&quot;)
 #=&gt; &quot;#&lt;TMail::Address mikel@lindsaar.net&gt;&quot;
 addr2 = TMail::Address.parse(&quot;Another &lt;mikel@lindsaar.net&gt;&quot;)
 #=&gt; &quot;#&lt;TMail::Address mikel@lindsaar.net&gt;&quot;
 addr1 == addr2
 #=&gt; true
</pre>
        </div>
      </div>

      <div id="method-M000275" class="method-detail">
        <a name="M000275"></a>

        <div class="method-heading">
          <span class="method-name">address</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Address.html#M000274">spec</a>
</p>
        </div>
      </div>

      <div id="method-M000273" class="method-detail">
        <a name="M000273"></a>

        <div class="method-heading">
          <a href="Address.src/M000273.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000273.html');return false;">
          <span class="method-name">domain</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the <a href="Address.html#M000273">domain</a> part of the email <a
href="Address.html#M000275">address</a>
</p>
<p>
For Example:
</p>
<pre>
 email = TMail::Address.parse(&quot;mikel@lindsaar.net&quot;)
 email.local
 #=&gt; &quot;lindsaar.net&quot;
</pre>
        </div>
      </div>

      <div id="method-M000279" class="method-detail">
        <a name="M000279"></a>

        <div class="method-heading">
          <a href="Address.src/M000279.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000279.html');return false;">
          <span class="method-name">dup</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Duplicates a <a href="Address.html">TMail::Address</a> object returning the
duplicate
</p>
<pre>
 addr1 = TMail::Address.parse(&quot;mikel@lindsaar.net&quot;)
 addr2 = addr1.dup
 addr1.id == addr2.id
 #=&gt; false
</pre>
        </div>
      </div>

      <div id="method-M000277" class="method-detail">
        <a name="M000277"></a>

        <div class="method-heading">
          <span class="method-name">eql?</span><span class="method-args">( other )</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for #==
</p>
        </div>
      </div>

      <div id="method-M000278" class="method-detail">
        <a name="M000278"></a>

        <div class="method-heading">
          <a href="Address.src/M000278.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000278.html');return false;">
          <span class="method-name">hash</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Provides a unique <a href="Address.html#M000278">hash</a> value for this
record against the <a href="Address.html#M000272">local</a> and <a
href="Address.html#M000273">domain</a> parts, ignores the name/phrase value
</p>
<pre>
 email = TMail::Address.parse(&quot;mikel@lindsaar.net&quot;)
 email.hash
 #=&gt; 18767598
</pre>
        </div>
      </div>

      <div id="method-M000272" class="method-detail">
        <a name="M000272"></a>

        <div class="method-heading">
          <a href="Address.src/M000272.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000272.html');return false;">
          <span class="method-name">local</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the <a href="Address.html#M000272">local</a> part of the email <a
href="Address.html#M000275">address</a>
</p>
<p>
For Example:
</p>
<pre>
 email = TMail::Address.parse(&quot;mikel@lindsaar.net&quot;)
 email.local
 #=&gt; &quot;mikel&quot;
</pre>
        </div>
      </div>

      <div id="method-M000269" class="method-detail">
        <a name="M000269"></a>

        <div class="method-heading">
          <a href="Address.src/M000269.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000269.html');return false;">
          <span class="method-name">name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Provides the <a href="Address.html#M000269">name</a> or
&#8216;phrase&#8217; of the email <a
href="Address.html#M000275">address</a>.
</p>
<p>
For Example:
</p>
<pre>
 email = TMail::Address.parse(&quot;Mikel Lindsaar &lt;mikel@lindsaar.net&gt;&quot;)
 email.name
 #=&gt; &quot;Mikel Lindsaar&quot;
</pre>
        </div>
      </div>

      <div id="method-M000270" class="method-detail">
        <a name="M000270"></a>

        <div class="method-heading">
          <a href="Address.src/M000270.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000270.html');return false;">
          <span class="method-name">name=</span><span class="method-args">( str )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Setter method for the <a href="Address.html#M000269">name</a> or phrase of
the email
</p>
<p>
For Example:
</p>
<pre>
 email = TMail::Address.parse(&quot;mikel@lindsaar.net&quot;)
 email.name
 #=&gt; nil
 email.name = &quot;Mikel Lindsaar&quot;
 email.to_s
 #=&gt; &quot;Mikel Lindsaar &lt;mikel@me.com&gt;&quot;
</pre>
        </div>
      </div>

      <div id="method-M000271" class="method-detail">
        <a name="M000271"></a>

        <div class="method-heading">
          <a href="Address.src/M000271.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000271.html');return false;">
          <span class="method-name">routes</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This is still here from RFC 822, and is now obsolete per RFC2822 Section 4.
</p>
<p>
&quot;When interpreting addresses, the route portion SHOULD be
ignored.&quot;
</p>
<p>
It is still here, so you can access it.
</p>
<p>
Routes return the route portion at the front of the email <a
href="Address.html#M000275">address</a>, if any.
</p>
<p>
For Example:
</p>
<pre>
 email = TMail::Address.parse( &quot;&lt;@sa,@another:Mikel@me.com&gt;&quot;)
 =&gt; #&lt;TMail::Address Mikel@me.com&gt;
 email.to_s
 =&gt; &quot;&lt;@sa,@another:Mikel@me.com&gt;&quot;
 email.routes
 =&gt; [&quot;sa&quot;, &quot;another&quot;]
</pre>
        </div>
      </div>

      <div id="method-M000274" class="method-detail">
        <a name="M000274"></a>

        <div class="method-heading">
          <a href="Address.src/M000274.html" target="Code" class="method-signature"
            onclick="popupCode('Address.src/M000274.html');return false;">
          <span class="method-name">spec</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the full specific <a href="Address.html#M000275">address</a> itself
</p>
<p>
For Example:
</p>
<pre>
 email = TMail::Address.parse(&quot;mikel@lindsaar.net&quot;)
 email.address
 #=&gt; &quot;mikel@lindsaar.net&quot;
</pre>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>