<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: P4RecId</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"> <h1>P4RecId <sup class="type-note">(Class)</sup></h1> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../files/p4table_rb.html"> p4table.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"> <p> ******************************************************************************* </p> <ul> <li>Class for creating and formatting record id’s. Normally these are just </li> <li>of the form "<tablename>/<nnnnnn>" </li> </ul> <p> ******************************************************************************* </p> </div> <div id="method-list"> <h2 class="section-bar">Methods</h2> <div class="name-list"> <a href="#M000007">new</a> <a href="#M000006">new_from_job</a> <a href="#M000005">next</a> <a href="#M000008">seq_str</a> <a href="#M000009">to_s</a> </div> </div> <div id="attribute-list"> <h2 class="section-bar">Attributes</h2> <div class="name-list"> <table> <tr class="top-aligned-row context-row"> <td class="context-item-name">seq</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">tablename</td> <td class="context-item-value"> [RW] </td> <td class="context-item-desc"></td> </tr> </table> </div> </div> </div> <!-- if includes --> <!-- if method_list --> <div id="methods"> <h2 class="section-bar">Public Class methods</h2> <div id="method-M000007" class="method-detail"> <a name="M000007"></a> <div class="method-heading"> <a href="#M000007" class="method-signature"> <span class="method-name">new</span><span class="method-args">( tablename, seq )</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000007-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000007-source"> <pre> <span class="ruby-comment cmt"># File p4table.rb, line 87</span> 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">tablename</span>, <span class="ruby-identifier">seq</span> ) 88: <span class="ruby-ivar">@tablename</span> = <span class="ruby-identifier">tablename</span> 89: <span class="ruby-keyword kw">if</span> ( <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">kind_of?</span>( <span class="ruby-constant">String</span> ) ) 90: <span class="ruby-keyword kw">if</span> ( <span class="ruby-identifier">seq</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^0*([1-9]\d+)$/</span> ) 91: <span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span> 92: <span class="ruby-keyword kw">else</span> 93: <span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">to_i</span> 94: <span class="ruby-keyword kw">end</span> 95: <span class="ruby-keyword kw">else</span> 96: <span class="ruby-ivar">@seq</span> = <span class="ruby-identifier">seq</span> 97: <span class="ruby-keyword kw">end</span> 98: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div id="method-M000006" class="method-detail"> <a name="M000006"></a> <div class="method-heading"> <a href="#M000006" class="method-signature"> <span class="method-name">new_from_job</span><span class="method-args">( p4, job )</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000006-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000006-source"> <pre> <span class="ruby-comment cmt"># File p4table.rb, line 78</span> 78: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">P4RecId</span>.<span class="ruby-identifier">new_from_job</span>( <span class="ruby-identifier">p4</span>, <span class="ruby-identifier">job</span> ) 79: ( <span class="ruby-identifier">table</span>, <span class="ruby-identifier">seq</span> ) = <span class="ruby-identifier">job</span>.<span class="ruby-identifier">split</span>( <span class="ruby-value str">"/"</span> ) 80: <span class="ruby-constant">P4RecId</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">table</span>, <span class="ruby-identifier">seq</span> ) 81: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div id="method-M000005" class="method-detail"> <a name="M000005"></a> <div class="method-heading"> <a href="#M000005" class="method-signature"> <span class="method-name">next</span><span class="method-args">( p4, table )</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000005-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000005-source"> <pre> <span class="ruby-comment cmt"># File p4table.rb, line 71</span> 71: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">P4RecId</span>.<span class="ruby-keyword kw">next</span>( <span class="ruby-identifier">p4</span>, <span class="ruby-identifier">table</span> ) 72: <span class="ruby-identifier">val</span> = <span class="ruby-identifier">p4</span>.<span class="ruby-identifier">run_counter</span>( <span class="ruby-identifier">table</span>.<span class="ruby-identifier">name</span> ).<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">to_i</span> 73: <span class="ruby-identifier">val</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> 74: <span class="ruby-identifier">p4</span>.<span class="ruby-identifier">run_counter</span>( <span class="ruby-identifier">table</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">val</span> ) 75: <span class="ruby-constant">P4RecId</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">table</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">val</span> ) 76: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <h2 class="section-bar">Public Instance methods</h2> <div id="method-M000008" class="method-detail"> <a name="M000008"></a> <div class="method-heading"> <a href="#M000008" class="method-signature"> <span class="method-name">seq_str</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000008-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000008-source"> <pre> <span class="ruby-comment cmt"># File p4table.rb, line 105</span> 105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seq_str</span> 106: <span class="ruby-identifier">sprintf</span>( <span class="ruby-value str">"%06d"</span>, <span class="ruby-ivar">@seq</span> ) 107: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div id="method-M000009" class="method-detail"> <a name="M000009"></a> <div class="method-heading"> <a href="#M000009" class="method-signature"> <span class="method-name">to_s</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000009-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000009-source"> <pre> <span class="ruby-comment cmt"># File p4table.rb, line 112</span> 112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span> 113: <span class="ruby-ivar">@tablename</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">seq_str</span>() 114: <span class="ruby-keyword kw">end</span> </pre> </div> </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>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 4678 | Tony Smith |
Update p4table.rb to use the new spec parsing and formatting features of P4Ruby. This means we now only need one Perforce client instance to handle specs in both hash form and text form. |
||
#1 | 4677 | Tony Smith |
Move P4table.rb to the P4Ruby library and rename it to p4table.rb instead. There's an update coming so this is just the move. |