FileType (Class)

In: P4Triggers.rb
Parent: Object

A class for encapsulating file types - type checking is quite common in many triggers so it’s nice to have it available to all.

Methods

match   new  

Attributes

msg  [R] 

Public Class methods

Provide a regexp that the filetype must match and a message for the types that match the regexp. i.e.

  FileType.new( /u?binary/, "binary/ubinary" )

[Source]

     # File P4Triggers.rb, line 109
109:     def initialize( regexp, message )
110:         @re    = regexp
111:         @msg   = message
112:     end

Public Instance methods

Test to see if the given filetype matches this type using the regexp.

[Source]

     # File P4Triggers.rb, line 118
118:     def match( type )
119:         @re.match( type ) 
120:     end

[Validate]