Sha256: a4aa7c82ae156dd01654c31e2772feb148dfa169b26012f8403fee1069b83d3e

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

#!/usr/bin/env ruby

=begin
|======================|
| PhoneNumberValidator |
|----------------------|
| Made by: bag33188    |
|======================|
=end

require 'phone_number_validator'

##
# <b>For command line usage:</b>
#
# Checks to see if the phone number the user entered is valid
# by testing regex the pattern with the phone number
#
# <b>Return Type:</b> 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()

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phone_number_validator-1.0.3 bin/pnv
phone_number_validator-1.0.0 bin/pnv
phone_number_validator-0.9.9 bin/pnv