Contents

Class P4::Spec < Hash require "P4"

Description

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):

Class Methods

new
new   P4::Spec.new( anArray ) -> aP4::Spec
Constructs a new P4::Spec object given an array of valid fieldnames.

Instance Methods

_<fieldname> _<fieldname>= permitted_fields
_<fieldname>   spec._<fieldname> -> aValue
Returns the value associated with the field named <fieldname>. This is equivalent to spec[ "<fieldname>" ] with the exception that when used as a method, the fieldnames may be in lowercase regardless of the actual case of the fieldname.
    client = p4.fetch_client()
    root   = client._root
    desc   = client._description
      
_<fieldname>=   spec._<fieldname>= aValue -> aValue
Updates the value of the named field in the spec. Raises a P4Exception if the fieldname is not valid for specs of this type.
    client = p4.fetch_client()

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

    p4.save_client( client )
      
permitted_fields   spec.permitted_fields -> anArray
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.

See Also

P4 P4Exception P4DepotFile P4Integration P4Revision