P4Spec.html #1

  • //
  • guest/
  • perforce_software/
  • p4ruby/
  • main/
  • doc/
  • P4Spec.html
  • View
  • Commits
  • Open Download .zip Download (4 KB)
<html>
<head>
  <title>P4/Ruby - P4::Spec</title>
  <link rel="stylesheet" type="text/css" href="docstyle.css">
</head>
<body>
  <p align="right">
    <a href="index.html">Contents</a>
  </p>

  <div class="classhdr">
    <table border=0>
      <tr>
	<td>
	  <span class="classtag">Class</span>
	  <span class="classname">P4::Spec</span>
	  <span class="classparent">&lt; Hash</span>
	</td>
	<td id="righttext">
	  <span class="requiretag">require</span>
	  <span class="modulename">"P4"</span>
	</td>
      </tr>
    </table>
  </div>
  <div class="classhdr">
  </div>

  <h3>Description</h3>

  The P4::Spec class is a hash containing key/value pairs for all the
  fields in a Perforce form. It provides two things over and above its
  parent class (Hash):

  <ul>
    <li>
      Fieldname validation. Only valid field names may be set in a 
      P4::Spec object. Note that only the field name is validated, not
      the content.
    </li>
    <li>
      Accessor methods for easy access to the fields
    </li>
  </ul>


  <div class="classmethods">
    <h3>Class Methods</h3>


    <div class="index">
      <table border="0">
	<tr>
	  <td>
	    <a href="#new">new</a>
	  </td>
	</tr>
      </table>
    </div>


    <a name="new"></a>
    <div class="method">
      <div class="methodheader">
	<table width="100%">
	  <tr>
	    <td class="meth_name">new</td>
	    <td>&nbsp;</td>
	    <td class="proto">
	      P4::Spec.new( <i>anArray</i> ) -&gt; <i>aP4::Spec</i>
	    </td>
	  </tr>
	</table>
      </div>

      Constructs a new P4::Spec object given an array of valid fieldnames.

    </div>
  </div>

  <div class="instancemethods">

    <h3>Instance Methods</h3>

    <div class="index">
      <table border="0">
	<tr>
	  <td>
	    <a href="#getters">_&lt;fieldname&gt;</a>
	  </td>
	  <td>
	    <a href="#setters">_&lt;fieldname&gt;=</a>
	  </td>
	  <td>
	    <a href="#permitted_fields">permitted_fields</a>
	  </td>
	</tr>
      </table>
    </div>


    <a name="getters"></a>
    <div class="method">
      <div class="methodheader">
	<table width="100%">
	  <tr>
	    <td class="meth_name">_&lt;fieldname&gt;</td>
	    <td>&nbsp;</td>
	    <td class="proto">
	      <i>spec</i>._&lt;fieldname&gt; -&gt; <i>aValue</i>
	    </td>
	  </tr>
	</table>
      </div>

      Returns the value associated with the field named &lt;fieldname&gt;.
      This is equivalent to 
      <span class="inlinecode">spec[ "&lt;fieldname&gt;" ]</span> with the
      exception that when used as a method, the fieldnames may be in 
      lowercase regardless of the actual case of the fieldname.

      <pre>
    client = p4.fetch_client()
    root   = client._root
    desc   = client._description
      </pre>
    </div>

    <a name="setters"></a>
    <div class="method">
      <div class="methodheader">
	<table width="100%">
	  <tr>
	    <td class="meth_name">_&lt;fieldname&gt;=</td>
	    <td>&nbsp;</td>
	    <td class="proto">
	      <i>spec</i>._&lt;fieldname&gt;= aValue -&gt; <i>aValue</i>
	    </td>
	  </tr>
	</table>
      </div>

      Updates the value of the named field in the spec. Raises a P4Exception
      if the fieldname is not valid for specs of this type.

      <pre>
    client = p4.fetch_client()

    client._root         = "/home/tony/new-client"
    client._description  = "My new client spec"

    p4.save_client( client )
      </pre>
    </div>

    <a name="permitted_fields"></a>
    <div class="method">
      <div class="methodheader">
	<table width="100%">
	  <tr>
	    <td class="meth_name">permitted_fields</td>
	    <td>&nbsp;</td>
	    <td class="proto">
	      <i>spec</i>.permitted_fields -&gt; <i>anArray</i>
	    </td>
	  </tr>
	</table>
      </div>

      Returns an array containing the names of fields that are valid in 
      this spec object. This does not imply that values for all of these 
      fields are actually set in this object, merely that you may choose to 
      set values for any of these fields if you wish to.
    </div>

  <div class="seealso">
    <h3>See Also</h3>

    <a href="P4.html">P4</a>
    <a href="P4Exception.html">P4Exception</a>
    <a href="P4DepotFile.html">P4DepotFile</a>
    <a href="P4Integration.html">P4Integration</a>
    <a href="P4Revision.html">P4Revision</a>
  </div>

</body>
</html>
# Change User Description Committed
#2 14520 tony Replace old P4Ruby documentation with a RELNOTES file, (and
ultimately, Doug's new manual), and update the MANIFEST to
match (and include the new tests)

I've also removed the old installer files as our new installer
won't use them.
#1 14480 tony Add P4Ruby 1.5944 to main as start-point for the first
productized release of P4Ruby