P4RecId (Class)

In: p4table.rb
Parent: Object

*******************************************************************************

  • Class for creating and formatting record id’s. Normally these are just
  • of the form "<tablename>/<nnnnnn>"

*******************************************************************************

Methods

new   new_from_job   next   seq_str   to_s  

Attributes

seq  [RW] 
tablename  [RW] 

Public Class methods

[Source]

    # File p4table.rb, line 87
87:     def initialize( tablename, seq )
88:         @tablename = tablename
89:         if ( seq.kind_of?( String ) )
90:             if ( seq =~ /^0*([1-9]\d+)$/ )
91:                 @seq = $1.to_i
92:             else
93:                 @seq = seq.to_i
94:             end
95:         else
96:             @seq = seq
97:         end
98:     end

[Source]

    # File p4table.rb, line 78
78:     def P4RecId.new_from_job( p4, job )
79:         ( table, seq ) = job.split( "/" )
80:         P4RecId.new( table, seq )
81:     end

[Source]

    # File p4table.rb, line 71
71:     def P4RecId.next( p4, table )
72:         val = p4.run_counter( table.name ).shift.to_i
73:         val += 1
74:         p4.run_counter( table.name, val )
75:         P4RecId.new( table.name, val )
76:     end

Public Instance methods

[Source]

     # File p4table.rb, line 105
105:     def seq_str
106:         sprintf( "%06d", @seq )
107:     end

[Source]

     # File p4table.rb, line 112
112:     def to_s
113:         @tablename + "/" + seq_str()
114:     end

[Validate]