<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: FileType</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel=StyleSheet href=".././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript" language="JavaScript"> <!-- function popCode(url) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } //--> </script> </head> <body bgcolor="white"> <table summary="Information on class" width="100%" border="0" cellspacing="0"> <tr class="title-row"> <td class="big-title-font"> <sup><font color="aqua">Class</font></sup> FileType </td> <td align="right"> <table summary="layout" cellspacing="0" cellpadding="2"> <tr valign="top"> <td class="small-title-font">In:</td> <td class="small-title-font"> <a href="../files/P4Triggers_rb.html" class="aqua"> P4Triggers.rb </a> <br /> </td> </tr> <tr> <td class="small-title-font">Parent:</td> <td class="small-title-font"> Object </td> </tr> </table> </td> </tr> </table> <!-- banner header --> <div class="description"><p> A class for encapsulating file types - type checking is quite common in many triggers so it’s nice to have it available to all. </p> </div> <table summary="Methods" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Methods</td></tr> </table> <div class="name-list"> <a href="#M000002">match</a> <a href="#M000001">new</a> </div> <table summary="Attributes" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Attributes</td></tr> </table> <table summary="Attribute details" cellspacing="5"> <tr valign="top"> <td class="attr-name">msg</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> </table> <table summary="Method list" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Public Class methods</td></tr> </table> <table summary="method" width="100%" cellspacing="0" cellpadding="5" border="0"> <tr><td class="methodtitle"> <a name="M000001"></a> <b>new</b>( regexp, message ) </td></tr> </table> <div class="description"> <p> Provide a regexp that the filetype must match and a message for the types that match the regexp. i.e. </p> <pre> FileType.new( /u?binary/, "binary/ubinary" ) </pre> </div> <pre class="source"> <span class="cmt"># File P4Triggers.rb, line 109</span> <span class="kw">def</span> initialize( regexp, message ) @re = regexp @msg = message <span class="kw">end</span> </pre> <table summary="Method list" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Public Instance methods</td></tr> </table> <table summary="method" width="100%" cellspacing="0" cellpadding="5" border="0"> <tr><td class="methodtitle"> <a name="M000002"></a> <b>match</b>( type ) </td></tr> </table> <div class="description"> <p> Test to see if the given filetype matches this type using the regexp. </p> </div> <pre class="source"> <span class="cmt"># File P4Triggers.rb, line 118</span> <span class="kw">def</span> match( type ) @re.match( type ) <span class="kw">end</span> </pre> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 4654 | Tony Smith |
Add an example spec trigger to show how you might restrict the default view for all new clients to a pre-defined set of mappings. |
||
#2 | 4640 | Tony Smith |
Add a sample post-commit trigger that can be used to keep a master and slave branch in sync. |
||
#1 | 3637 | Tony Smith | Add RDoc documentation to the sample triggers. |