phone_number_validator 0.4.2 → 0.4.3

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.
data/doc/js/darkfish.js CHANGED
@@ -59,7 +59,7 @@ function hookSearch() {
59
59
  var html = '';
60
60
 
61
61
  // TODO add relative path to <script> per-page
62
- html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
62
+ html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
63
63
  if (result.params)
64
64
  html += '<span class="params">' + result.params + '</span>';
65
65
  html += '</a>';
@@ -121,9 +121,9 @@ function highlightClickTarget( event ) {
121
121
  };
122
122
  };
123
123
 
124
- function loadAsync(path, success) {
124
+ function loadAsync(path, success, prefix) {
125
125
  $.ajax({
126
- url: rdoc_rel_prefix + path,
126
+ url: prefix + path,
127
127
  dataType: 'script',
128
128
  success: success,
129
129
  cache: true
@@ -154,8 +154,8 @@ $(document).ready( function() {
154
154
  });
155
155
  }
156
156
 
157
- loadAsync('js/navigation.js', search_success_function('navigation_loaded'));
158
- loadAsync('js/search.js', search_success_function('search_loaded'));
159
- loadAsync('js/search_index.js', search_success_function('search_index_loaded'));
160
- loadAsync('js/searcher.js', search_success_function('searcher_loaded'));
157
+ loadAsync('js/navigation.js', search_success_function('navigation_loaded'), rdoc_rel_prefix);
158
+ loadAsync('js/search.js', search_success_function('search_loaded'), rdoc_rel_prefix);
159
+ loadAsync('js/search_index.js', search_success_function('search_index_loaded'), index_rel_prefix);
160
+ loadAsync('js/searcher.js', search_success_function('searcher_loaded'), rdoc_rel_prefix);
161
161
  });
Binary file
Binary file
data/doc/js/searcher.js CHANGED
@@ -172,6 +172,7 @@ Searcher.prototype = new function() {
172
172
  result.path = info[2];
173
173
  result.params = info[3];
174
174
  result.snippet = info[4];
175
+ result.badge = info[6];
175
176
  return result;
176
177
  }
177
178
 
Binary file
@@ -1,97 +1,98 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>Table of Contents - Phone Number Validator</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "./";
11
- </script>
12
-
13
- <script src="./js/jquery.js"></script>
14
- <script src="./js/darkfish.js"></script>
15
-
16
- <link href="./css/fonts.css" rel="stylesheet">
17
- <link href="./css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" class="table-of-contents">
22
- <main role="main">
23
- <h1 class="class">Table of Contents - Phone Number Validator</h1>
24
-
25
- <h2 id="pages">Pages</h2>
26
- <ul>
27
- <li class="file">
28
- <a href="README_rdoc.html">README</a>
29
-
30
- <ul>
31
- <li><a href="README_rdoc.html#label-Phone+Number+Validator">Phone Number Validator</a>
32
- <li><a href="README_rdoc.html#label-About">About</a>
33
- <li><a href="README_rdoc.html#label-Regular+Expression">Regular Expression</a>
34
- <li><a href="README_rdoc.html#label-Installing">Installing</a>
35
- <li><a href="README_rdoc.html#label-Install+Required+Gems-2FDependencies">Install Required Gems/Dependencies</a>
36
- <li><a href="README_rdoc.html#label-Updateing+Required+Gems-2FDependencies">Updateing Required Gems/Dependencies</a>
37
- <li><a href="README_rdoc.html#label-Uninstalling">Uninstalling</a>
38
- <li><a href="README_rdoc.html#label-Testing">Testing</a>
39
- <li><a href="README_rdoc.html#label-Usage">Usage</a>
40
- <li><a href="README_rdoc.html#label-In+command+line">In command line</a>
41
- <li><a href="README_rdoc.html#label-In+Ruby+code">In Ruby code</a>
42
- <li><a href="README_rdoc.html#label-Output">Output</a>
43
- </ul>
44
- </li>
45
-
46
- </ul>
47
-
48
- <h2 id="classes">Classes and Modules</h2>
49
- <ul>
50
- <li class="class">
51
- <a href="PhoneNumberValidator.html">PhoneNumberValidator</a>
52
- </li>
53
- <li class="class">
54
- <a href="PhoneNumberValidator/Validator.html">PhoneNumberValidator::Validator</a>
55
- </li>
56
- <li class="class">
57
- <a href="PhoneNumberValidatorTest.html">PhoneNumberValidatorTest</a>
58
- </li>
59
- </ul>
60
-
61
- <h2 id="methods">Methods</h2>
62
- <ul>
63
-
64
- <li class="method">
65
- <a href="PhoneNumberValidator/Validator.html#method-c-new">::new</a>
66
- &mdash;
67
- <span class="container">PhoneNumberValidator::Validator</span>
68
-
69
- <li class="method">
70
- <a href="PhoneNumberValidator.html#method-c-validate_phone_number">::validate_phone_number</a>
71
- &mdash;
72
- <span class="container">PhoneNumberValidator</span>
73
-
74
- <li class="method">
75
- <a href="PhoneNumberValidatorTest.html#method-i-test_invalid_phone_number">#test_invalid_phone_number</a>
76
- &mdash;
77
- <span class="container">PhoneNumberValidatorTest</span>
78
-
79
- <li class="method">
80
- <a href="PhoneNumberValidatorTest.html#method-i-test_valid_phone_number">#test_valid_phone_number</a>
81
- &mdash;
82
- <span class="container">PhoneNumberValidatorTest</span>
83
-
84
- <li class="method">
85
- <a href="PhoneNumberValidator/Validator.html#method-i-validate_phone_number">#validate_phone_number</a>
86
- &mdash;
87
- <span class="container">PhoneNumberValidator::Validator</span>
88
- </ul>
89
- </main>
90
-
91
-
92
- <footer id="validator-badges" role="contentinfo">
93
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
94
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
95
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
96
- </footer>
97
-
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>Table of Contents - Phone Number Validator</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" class="table-of-contents">
23
+ <main role="main">
24
+ <h1 class="class">Table of Contents - Phone Number Validator</h1>
25
+
26
+ <h2 id="pages">Pages</h2>
27
+ <ul>
28
+ <li class="file">
29
+ <a href="README_rdoc.html">README</a>
30
+
31
+ <ul>
32
+ <li><a href="README_rdoc.html#label-Phone+Number+Validator">Phone Number Validator</a>
33
+ <li><a href="README_rdoc.html#label-About">About</a>
34
+ <li><a href="README_rdoc.html#label-Regular+Expression">Regular Expression</a>
35
+ <li><a href="README_rdoc.html#label-Installing">Installing</a>
36
+ <li><a href="README_rdoc.html#label-Install+Required+Gems-2FDependencies">Install Required Gems/Dependencies</a>
37
+ <li><a href="README_rdoc.html#label-Updateing+Required+Gems-2FDependencies">Updateing Required Gems/Dependencies</a>
38
+ <li><a href="README_rdoc.html#label-Uninstalling">Uninstalling</a>
39
+ <li><a href="README_rdoc.html#label-Testing">Testing</a>
40
+ <li><a href="README_rdoc.html#label-Usage">Usage</a>
41
+ <li><a href="README_rdoc.html#label-In+command+line">In command line</a>
42
+ <li><a href="README_rdoc.html#label-In+Ruby+code">In Ruby code</a>
43
+ <li><a href="README_rdoc.html#label-Output">Output</a>
44
+ </ul>
45
+ </li>
46
+
47
+ </ul>
48
+
49
+ <h2 id="classes">Classes and Modules</h2>
50
+ <ul>
51
+ <li class="class">
52
+ <a href="PhoneNumberValidator.html">PhoneNumberValidator</a>
53
+ </li>
54
+ <li class="class">
55
+ <a href="PhoneNumberValidator/Validator.html">PhoneNumberValidator::Validator</a>
56
+ </li>
57
+ <li class="class">
58
+ <a href="PhoneNumberValidatorTest.html">PhoneNumberValidatorTest</a>
59
+ </li>
60
+ </ul>
61
+
62
+ <h2 id="methods">Methods</h2>
63
+ <ul>
64
+
65
+ <li class="method">
66
+ <a href="PhoneNumberValidator/Validator.html#method-c-new">::new</a>
67
+ &mdash;
68
+ <span class="container">PhoneNumberValidator::Validator</span>
69
+
70
+ <li class="method">
71
+ <a href="PhoneNumberValidator.html#method-c-validate_phone_number">::validate_phone_number</a>
72
+ &mdash;
73
+ <span class="container">PhoneNumberValidator</span>
74
+
75
+ <li class="method">
76
+ <a href="PhoneNumberValidatorTest.html#method-i-test_invalid_phone_number">#test_invalid_phone_number</a>
77
+ &mdash;
78
+ <span class="container">PhoneNumberValidatorTest</span>
79
+
80
+ <li class="method">
81
+ <a href="PhoneNumberValidatorTest.html#method-i-test_valid_phone_number">#test_valid_phone_number</a>
82
+ &mdash;
83
+ <span class="container">PhoneNumberValidatorTest</span>
84
+
85
+ <li class="method">
86
+ <a href="PhoneNumberValidator/Validator.html#method-i-validate_phone_number">#validate_phone_number</a>
87
+ &mdash;
88
+ <span class="container">PhoneNumberValidator::Validator</span>
89
+ </ul>
90
+ </main>
91
+
92
+
93
+ <footer id="validator-badges" role="contentinfo">
94
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
95
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.4.
96
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
97
+ </footer>
98
+
@@ -1,34 +1,34 @@
1
- ##
2
- # This class does all of the matching and checking work for the validation of the phone number.
3
- class PhoneNumberValidator::Validator
4
-
5
- ##
6
- # The regex pattern for validating US phone numbers
7
- #
8
- # Regular Expression tested using {regexr.com}[https://regexr.com/]
9
- #
10
- # The regular expression used can be found in <em>README.rdoc</em> on the documentation's home page
11
- PHONE_NUMBER_REGEX = Regexp.new('^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$', Regexp::IGNORECASE)
12
-
13
- ##
14
- # initializes the <b>@phone_number</b> instance variable
15
- def initialize(phone_number = '+1 (949) 355-6244 ext. 198842')
16
- @phone_number = phone_number
17
- end
18
-
19
- ##
20
- # Checks to see if the phone number the user entered is valid
21
- # by testing regex the pattern with the phone number
22
- #
23
- # <b>Return Type:</b>
24
- # boolean
25
- def validate_phone_number
26
- if (@phone_number.match(PHONE_NUMBER_REGEX))
27
- puts "\"%s\" is a valid phone number." % @phone_number
28
- return true
29
- else
30
- puts "\"%s\" is not a valid phone number." % @phone_number
31
- return false
32
- end
33
- end
34
- end
1
+ ##
2
+ # This class does all of the matching and checking work for the validation of the phone number.
3
+ class PhoneNumberValidator::Validator
4
+
5
+ ##
6
+ # The regex pattern for validating US phone numbers
7
+ #
8
+ # Regular Expression tested using {regexr.com}[https://regexr.com/]
9
+ #
10
+ # The regular expression used can be found in <em>README.rdoc</em> on the documentation's home page
11
+ PHONE_NUMBER_REGEX = Regexp.new('^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$', Regexp::IGNORECASE)
12
+
13
+ ##
14
+ # initializes the <b>@phone_number</b> instance variable
15
+ def initialize(phone_number = '+1 (949) 355-6244 ext. 198842')
16
+ @phone_number = phone_number
17
+ end
18
+
19
+ ##
20
+ # Checks to see if the phone number the user entered is valid
21
+ # by testing regex the pattern with the phone number
22
+ #
23
+ # <b>Return Type:</b>
24
+ # boolean
25
+ def validate_phone_number
26
+ if (@phone_number.match(PHONE_NUMBER_REGEX))
27
+ puts "\"%s\" is a valid phone number." % @phone_number
28
+ return true
29
+ else
30
+ puts "\"%s\" is not a valid phone number." % @phone_number
31
+ return false
32
+ end
33
+ end
34
+ end
@@ -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.2'
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.4.3'
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,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
- end
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
+ end