phony 2.12.0 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phony/countries.rb +1 -1
- data/lib/phony/country.rb +2 -2
- data/spec/functional/plausibility_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df08cdef9c3c23e6aaa8895f501bab5c7257e174
|
4
|
+
data.tar.gz: 8ae9fa56084ca73ccf1c2320429cd057c83fe4d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b4d98a8fec4023334c3f2f91528005db4e321dbd743fafa7b3666a4685966d03859700ee7123a7f16842d6a844096194df31ce3304291f1bc922f6effbd47f8
|
7
|
+
data.tar.gz: 6f3921fabdc4294cd8479673bae46d3ef2c6fbd6304f3f5c705874694a63e3d71532d45fe4f0848009e7d485be5f570e3595fcaa686bd76e5ab9f16aff74f0d4
|
data/lib/phony/countries.rb
CHANGED
@@ -35,7 +35,7 @@ Phony.define do
|
|
35
35
|
# The US has a delimiter between NDC and local number.
|
36
36
|
trunk('1%s', normalize: true) | # http://en.wikipedia.org/wiki/Trunk_prefix
|
37
37
|
fixed(3) >> split(3,4),
|
38
|
-
:invalid_ndcs => [
|
38
|
+
:invalid_ndcs => /[0-2]\d{2}|[3-9]11/
|
39
39
|
|
40
40
|
# Kazakhstan (Republic of) & Russsian Federation.
|
41
41
|
# also Abhasia and South Osetia autonomous regions / recognized by some states as independent countries
|
data/lib/phony/country.rb
CHANGED
@@ -26,7 +26,7 @@ module Phony
|
|
26
26
|
#
|
27
27
|
def with cc, options = {}
|
28
28
|
@cc = cc
|
29
|
-
@invalid_ndcs = options[:invalid_ndcs]
|
29
|
+
@invalid_ndcs = options[:invalid_ndcs]
|
30
30
|
@format = options[:format]
|
31
31
|
@space = options[:space]
|
32
32
|
@local_space = options[:local_space]
|
@@ -97,7 +97,7 @@ module Phony
|
|
97
97
|
#
|
98
98
|
return false if ndc.nil?
|
99
99
|
return false if ndc && ndc.empty?
|
100
|
-
return false if @invalid_ndcs
|
100
|
+
return false if @invalid_ndcs && @invalid_ndcs === ndc
|
101
101
|
|
102
102
|
# # A valid range for the rest is 0 or 3+ total digits.
|
103
103
|
# #
|
@@ -519,6 +519,8 @@ describe 'plausibility' do
|
|
519
519
|
Phony.plausible?('1-800-692-7753').should be_true
|
520
520
|
Phony.plausible?('1-911').should be_false
|
521
521
|
Phony.plausible?('1-911-123-1234').should be_false
|
522
|
+
Phony.plausible?('1-411-123-1234').should be_false
|
523
|
+
Phony.plausible?('1-040-123-1234').should be_false
|
522
524
|
Phony.plausible?('143466677777').should be_false # too long
|
523
525
|
Phony.plausible?('143466677').should be_false # too short
|
524
526
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|