phone_number_validator 0.4.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +25 -25
- data/Gemfile +6 -6
- data/LICENSE +21 -21
- data/README.rdoc +56 -56
- data/Rakefile +27 -27
- data/bin/pnv +18 -23
- data/doc/PhoneNumberValidator/Validator.html +233 -230
- data/doc/PhoneNumberValidator.html +170 -170
- data/doc/PhoneNumberValidatorTest.html +235 -198
- data/doc/README_rdoc.html +159 -159
- data/doc/created.rid +6 -6
- data/doc/index.html +154 -154
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +103 -98
- data/lib/phone_number_validator/validator.rb +37 -34
- data/lib/phone_number_validator.rb +25 -25
- data/phone_number_validator.gemspec +32 -32
- data/test/test_phone_number_validator.rb +31 -24
- metadata +3 -3
| @@ -1,25 +1,25 @@ | |
| 1 | 
            -
            ##
         | 
| 2 | 
            -
            # This class is the master/parent class to all of the validation functionality
         | 
| 3 | 
            -
            class PhoneNumberValidator
         | 
| 4 | 
            -
              class << self
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                ##
         | 
| 7 | 
            -
                # Validates any United States phone number!
         | 
| 8 | 
            -
                #
         | 
| 9 | 
            -
                # <b>Example:</b>
         | 
| 10 | 
            -
                #   PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
         | 
| 11 | 
            -
                #
         | 
| 12 | 
            -
                # <b>Output:</b>
         | 
| 13 | 
            -
                #   => '+1 (949) 355-6244 ext. 198842' is a valid phone number.'
         | 
| 14 | 
            -
                #   => true
         | 
| 15 | 
            -
                #
         | 
| 16 | 
            -
                # <b>Arguments:</b>
         | 
| 17 | 
            -
                #   phone_number: (String)
         | 
| 18 | 
            -
                def validate_phone_number(phone_number)
         | 
| 19 | 
            -
                  validator = Validator.new(phone_number)
         | 
| 20 | 
            -
                  validator.validate_phone_number
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
            end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            require 'phone_number_validator/validator'
         | 
| 1 | 
            +
            ##
         | 
| 2 | 
            +
            # This class is the master/parent class to all of the validation functionality
         | 
| 3 | 
            +
            class PhoneNumberValidator
         | 
| 4 | 
            +
              class << self
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                ##
         | 
| 7 | 
            +
                # Validates any United States phone number!
         | 
| 8 | 
            +
                #
         | 
| 9 | 
            +
                # <b>Example:</b>
         | 
| 10 | 
            +
                #   PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
         | 
| 11 | 
            +
                #
         | 
| 12 | 
            +
                # <b>Output:</b>
         | 
| 13 | 
            +
                #   => '+1 (949) 355-6244 ext. 198842' is a valid phone number.'
         | 
| 14 | 
            +
                #   => true
         | 
| 15 | 
            +
                #
         | 
| 16 | 
            +
                # <b>Arguments:</b>
         | 
| 17 | 
            +
                #   phone_number: (String)
         | 
| 18 | 
            +
                def validate_phone_number(phone_number)
         | 
| 19 | 
            +
                  validator = Validator.new(phone_number)
         | 
| 20 | 
            +
                  validator.validate_phone_number
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            require 'phone_number_validator/validator'
         | 
| @@ -1,32 +1,32 @@ | |
| 1 | 
            -
            Gem::Specification.new do |spec|
         | 
| 2 | 
            -
              spec.name                      = 'phone_number_validator'
         | 
| 3 | 
            -
              spec.version                   = '0. | 
| 4 | 
            -
              spec.date                      = Time.now.strftime("%Y-%m-%d")
         | 
| 5 | 
            -
              spec.summary                   = 'Validate any US phone number!'
         | 
| 6 | 
            -
              spec.description               = <<-EOF
         | 
| 7 | 
            -
                This gem is a United States phone number validator.
         | 
| 8 | 
            -
                This gem uses a complex regular expression that can validate any United States phone number.
         | 
| 9 | 
            -
              EOF
         | 
| 10 | 
            -
              spec.author                    = 'bag33188'
         | 
| 11 | 
            -
              spec.email                     = 'bag33188@outlook.com'
         | 
| 12 | 
            -
              spec.files                     = `git ls-files -z`.split("\x0")
         | 
| 13 | 
            -
            # spec.files                     = ['phone_number_validator.gemspec', 'Gemfile', 'Rakefile', 'LICENSE', 'README.rdoc']
         | 
| 14 | 
            -
            # spec.files                    +=  Dir['lib/**/*'] + Dir['bin/*'] + Dir['doc/**/*']
         | 
| 15 | 
            -
              spec.require_paths             = ['lib', 'lib/phone_number_validator', 'doc', 'test', 'bin', '.']
         | 
| 16 | 
            -
              spec.test_files                = ['test/test_phone_number_validator.rb']
         | 
| 17 | 
            -
              spec.executables               << 'pnv'
         | 
| 18 | 
            -
              spec.homepage                  = 'https://gitlab.com/bag3318/phone_number_validator'
         | 
| 19 | 
            -
              spec.license                   = 'MIT'
         | 
| 20 | 
            -
              spec.bindir                    = 'bin'
         | 
| 21 | 
            -
              spec.extra_rdoc_files          = ['README.rdoc']
         | 
| 22 | 
            -
              spec.platform                  = Gem::Platform::RUBY
         | 
| 23 | 
            -
              spec.required_ruby_version     = '>= 2.0.0'
         | 
| 24 | 
            -
              spec.required_rubygems_version = '>= 2.6.0'
         | 
| 25 | 
            -
              spec.post_install_message      = "\r\nThanks for installing my phone_number_validator gem!\r\nI hope you will enjoy using it! :)\r\n\r\n"
         | 
| 26 | 
            -
              spec.requirements             << 'A Windows, Mac, or Linux computer with Ruby and RubyGems Installed.'
         | 
| 27 | 
            -
              spec.metadata                  = {
         | 
| 28 | 
            -
                'bug_tracker_uri'            => 'https://gitlab.com/bag3318/phone_number_validator/issues',
         | 
| 29 | 
            -
                'source_code_uri'            => 'https://gitlab.com/bag3318/phone_number_validator'
         | 
| 30 | 
            -
              }
         | 
| 31 | 
            -
              spec.add_runtime_dependency    'bundler', '~> 1.11', '>= 1.11.2'
         | 
| 32 | 
            -
            end
         | 
| 1 | 
            +
            Gem::Specification.new do |spec|
         | 
| 2 | 
            +
              spec.name                      = 'phone_number_validator'
         | 
| 3 | 
            +
              spec.version                   = '0.5.0'
         | 
| 4 | 
            +
              spec.date                      = Time.now.strftime("%Y-%m-%d")
         | 
| 5 | 
            +
              spec.summary                   = 'Validate any US phone number!'
         | 
| 6 | 
            +
              spec.description               = <<-EOF
         | 
| 7 | 
            +
                This gem is a United States phone number validator.
         | 
| 8 | 
            +
                This gem uses a complex regular expression that can validate any United States phone number.
         | 
| 9 | 
            +
              EOF
         | 
| 10 | 
            +
              spec.author                    = 'bag33188'
         | 
| 11 | 
            +
              spec.email                     = 'bag33188@outlook.com'
         | 
| 12 | 
            +
              spec.files                     = `git ls-files -z`.split("\x0")
         | 
| 13 | 
            +
            # spec.files                     = ['phone_number_validator.gemspec', 'Gemfile', 'Rakefile', 'LICENSE', 'README.rdoc']
         | 
| 14 | 
            +
            # spec.files                    +=  Dir['lib/**/*'] + Dir['bin/*'] + Dir['doc/**/*']
         | 
| 15 | 
            +
              spec.require_paths             = ['lib', 'lib/phone_number_validator', 'doc', 'test', 'bin', '.']
         | 
| 16 | 
            +
              spec.test_files                = ['test/test_phone_number_validator.rb']
         | 
| 17 | 
            +
              spec.executables               << 'pnv'
         | 
| 18 | 
            +
              spec.homepage                  = 'https://gitlab.com/bag3318/phone_number_validator'
         | 
| 19 | 
            +
              spec.license                   = 'MIT'
         | 
| 20 | 
            +
              spec.bindir                    = 'bin'
         | 
| 21 | 
            +
              spec.extra_rdoc_files          = ['README.rdoc']
         | 
| 22 | 
            +
              spec.platform                  = Gem::Platform::RUBY
         | 
| 23 | 
            +
              spec.required_ruby_version     = '>= 2.0.0'
         | 
| 24 | 
            +
              spec.required_rubygems_version = '>= 2.6.0'
         | 
| 25 | 
            +
              spec.post_install_message      = "\r\nThanks for installing my phone_number_validator gem!\r\nI hope you will enjoy using it! :)\r\n\r\n"
         | 
| 26 | 
            +
              spec.requirements             << 'A Windows, Mac, or Linux computer with Ruby and RubyGems Installed.'
         | 
| 27 | 
            +
              spec.metadata                  = {
         | 
| 28 | 
            +
                'bug_tracker_uri'            => 'https://gitlab.com/bag3318/phone_number_validator/issues',
         | 
| 29 | 
            +
                'source_code_uri'            => 'https://gitlab.com/bag3318/phone_number_validator'
         | 
| 30 | 
            +
              }
         | 
| 31 | 
            +
              spec.add_runtime_dependency    'bundler', '~> 1.11', '>= 1.11.2'
         | 
| 32 | 
            +
            end
         | 
| @@ -1,24 +1,31 @@ | |
| 1 | 
            -
            require 'test/unit'
         | 
| 2 | 
            -
            require 'phone_number_validator'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            ##
         | 
| 5 | 
            -
            # This class respresents the testing-unit for this gem app
         | 
| 6 | 
            -
            #
         | 
| 7 | 
            -
            # <b>Inherits from:</b>
         | 
| 8 | 
            -
            #   Test::Unit::TestCase
         | 
| 9 | 
            -
            class PhoneNumberValidatorTest < Test::Unit::TestCase
         | 
| 10 | 
            -
             | 
| 11 | 
            -
              ##
         | 
| 12 | 
            -
              # This test inputs a valid phone number and expects the output to be <b>true</b>
         | 
| 13 | 
            -
              def test_valid_phone_number
         | 
| 14 | 
            -
                assert_equal true,
         | 
| 15 | 
            -
                PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              ##
         | 
| 19 | 
            -
              # This test inputs an invalid phone number and expects the output to be <b>false</b>
         | 
| 20 | 
            -
              def test_invalid_phone_number
         | 
| 21 | 
            -
                assert_equal false,
         | 
| 22 | 
            -
                PhoneNumberValidator.validate_phone_number('94643823637337')
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
             | 
| 1 | 
            +
            require 'test/unit'
         | 
| 2 | 
            +
            require 'phone_number_validator'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            ##
         | 
| 5 | 
            +
            # This class respresents the testing-unit for this gem app
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # <b>Inherits from:</b>
         | 
| 8 | 
            +
            #   Test::Unit::TestCase
         | 
| 9 | 
            +
            class PhoneNumberValidatorTest < Test::Unit::TestCase
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              ##
         | 
| 12 | 
            +
              # This test inputs a valid phone number and expects the output to be <b>true</b>
         | 
| 13 | 
            +
              def test_valid_phone_number
         | 
| 14 | 
            +
                assert_equal true,
         | 
| 15 | 
            +
                PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              ##
         | 
| 19 | 
            +
              # This test inputs an invalid phone number and expects the output to be <b>false</b>
         | 
| 20 | 
            +
              def test_invalid_phone_number
         | 
| 21 | 
            +
                assert_equal false,
         | 
| 22 | 
            +
                PhoneNumberValidator.validate_phone_number('94643823637337')
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              ##
         | 
| 26 | 
            +
              # This test inputs no phone number and expectst he output to be <b>:nil</b>
         | 
| 27 | 
            +
              def test_no_phone_number
         | 
| 28 | 
            +
                assert_equal :nil,
         | 
| 29 | 
            +
                PhoneNumberValidator.validate_phone_number('')
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: phone_number_validator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - bag33188
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-11- | 
| 11 | 
            +
            date: 2018-11-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 128 128 | 
             
            requirements:
         | 
| 129 129 | 
             
            - A Windows, Mac, or Linux computer with Ruby and RubyGems Installed.
         | 
| 130 130 | 
             
            rubyforge_project: 
         | 
| 131 | 
            -
            rubygems_version: 2.7. | 
| 131 | 
            +
            rubygems_version: 2.7.6
         | 
| 132 132 | 
             
            signing_key: 
         | 
| 133 133 | 
             
            specification_version: 4
         | 
| 134 134 | 
             
            summary: Validate any US phone number!
         |