#!/usr/bin/env ruby
=begin
|======================|
| PhoneNumberValidator |
|----------------------|
| Made by: bag33188 |
|======================|
=end
require 'phone_number_validator'
##
# 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."
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
# call pnv function
pnv()