class Object

Public Instance Methods

pnv() click to toggle source

For command line usage:

Checks to see if the phone number the user entered is valid by testing regex the pattern with the phone number

Return Type: boolean or string

Examples

Ex. 1

$ pnv "+1 (987) 654-3210 ext. 198842"
Output
=> true

Ex. 2

pnv "+1 (987 778873-321a0 ext.ff99"
Output
=> false

Ex. 3

pnv ""
Output
=> "No phone number entered."

Ex. 4

pnv
Output
=> "No phone number entered."
# File bin/pnv, line 52
def pnv
  if (ARGV[0] == nil || ARGV[0] == '')
    print "No phone number entered.\r\n"
  else
    # execute validator
    puts PhoneNumberValidator.validate(ARGV[0])
  end
end