The P4::Spec
class is a hash containing key/value
pairs for all the fields in a
Helix server
form. It provides two things over and above its parent class (Hash):
P4::Spec
object. Note that only the field name is
validated, not the content.Constructs a new P4::Spec
object given an array of
valid fieldnames.
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
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/bruno/new-client"
client._description = "My new client spec"
p4.save_client( client )
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 want to.
client = p4.fetch_client()
spec.permitted_fields.each do
| field |
printf ( "%14s = %s\n", field, client[ field ] )
end