phony 2.0.0.beta5 → 2.0.0.beta7
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjc3MTQzMDcxZTgxYWJjYzhiODY5OTU5ZjNiYzc3MTIxYjdmMmI0Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTUzMjAxNDMwMmRhODAzMDZhNjA1YWVkMmI1ZDQ0MDhlMzc5MDU0ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjdmYTJkOTk1NjA1NmNjNmExNDI2OWU4YTAyNTQ2ZWQyMjUwMmVmYWZkM2Vi
|
10
|
+
ODA1YTMzOWY3ZGJjNGFhOWRkYTM2M2MxZWVhZDZjOTlkMWQ5Y2QzZTdkZjZl
|
11
|
+
YzQxNzM5NDM2MWIzMWQxODBhNGQwOTc4MTYwYmM1MjFjY2FmYmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWI3MTg5Zjc3NGI4ODFjZWY4NDViYzAxMjhlYmRiZTk1NjYwY2MzY2VjZTRm
|
14
|
+
NTg3YjgzNTQwN2U4ZmJlOTQxMGIyNDgxOWU3YjZhMWQ0ZWUwOWIwODc2Yzhm
|
15
|
+
ODI1Yjk2MTE2YjhiYWE2ZTM1ZDlmNDNmOGE2MDViMGRmMDU5M2U=
|
data/lib/phony/countries.rb
CHANGED
@@ -110,14 +110,18 @@ ndcs_with_6_subscriber_digits = %w(3012 3022 3412 3435 3439 3452 3456 3462 3463
|
|
110
110
|
862 8634 8635 8636 8639 8652 8662 8672 8712 8722 8732 8772 8782 8793
|
111
111
|
)
|
112
112
|
|
113
|
-
ndcs_with_7_subscriber_digits = %w(342 343 347 351 383 391 473 495 496 498 499 812 818 831 843 844 846 861 862 863
|
113
|
+
ndcs_with_7_subscriber_digits = %w(342 343 347 351 383 391 473 495 496 498 499 812 818 831 843 844 846 861 862 863
|
114
|
+
901 902 903 904 905 906 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
|
115
|
+
930 931 932 933 934 936 937 938 950 951 952 953 960 961 962 963 964 965 967 968 980 981 982 983 984 985 987 988
|
116
|
+
989 997
|
117
|
+
)
|
114
118
|
|
115
119
|
Phony.define do
|
116
120
|
country '7', one_of(ndcs_with_5_subscriber_digits) >> trunk('8') >> split(1, 2, 2) |
|
117
121
|
one_of(ndcs_with_6_subscriber_digits) >> trunk('8') >> split(2, 2, 2) |
|
118
122
|
one_of(ndcs_with_7_subscriber_digits) >> trunk('8') >> split(3, 2, 2) |
|
119
123
|
one_of(%w(800)) >> trunk('8') >> split(3, 2, 2) | # Russia free number
|
120
|
-
one_of(%w(
|
124
|
+
one_of(%w(995344 9971 99744 9976 997)) >> trunk('8') >> split(2, 2, 2) | # South Osetia
|
121
125
|
|
122
126
|
# The two following lines have been replaced by fixed(3).
|
123
127
|
#
|
@@ -125,4 +129,4 @@ Phony.define do
|
|
125
129
|
# one_of(%w(840 940)) >> split(2,2,2) # Abhasia
|
126
130
|
|
127
131
|
fixed(3) >> trunk('8') >> split(2,2,3) # TODO 2,2,3 or 2,2,2?
|
128
|
-
end
|
132
|
+
end
|
@@ -468,6 +468,7 @@ describe 'country descriptions' do
|
|
468
468
|
it_splits '78122345678', ['7', '812', '234', '56', '78'] # Russia 3-digit
|
469
469
|
it_splits '74012771077', ['7', '4012', '77', '10', '77'] # Russia 4-digit
|
470
470
|
it_splits '78402411212', ['7', '84024', '1', '12', '12'] # Russia 5-digit
|
471
|
+
it_splits '79296119119', ['7', '929', '611', '91', '19'] # Russia 3-digit, Megafon Mobile.
|
471
472
|
it_splits '7840121212', ['7', '840', '12', '12', '12'] # Abhasia
|
472
473
|
it_splits '7799121212', ['7', '799', '12', '12', '12'] # Kazachstan
|
473
474
|
it_splits '7995344121212', ['7','995344','12','12','12'] # South Osetia
|
data/spec/lib/phony_spec.rb
CHANGED
@@ -100,6 +100,12 @@ describe Phony do
|
|
100
100
|
it 'should format american numbers' do
|
101
101
|
Phony.format('18705551122').should == '+1 870 555 1122'
|
102
102
|
end
|
103
|
+
it 'should format New Zealand 021 mobile numbers' do
|
104
|
+
Phony.format('64211234567').should == '+64 21 123 4567'
|
105
|
+
end
|
106
|
+
it 'should format New Zealand landline numbers' do
|
107
|
+
Phony.format('6493791234').should == '+64 9 379 1234'
|
108
|
+
end
|
103
109
|
end
|
104
110
|
describe 'international' do
|
105
111
|
it 'should format north american numbers' do
|
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.0.0.
|
4
|
+
version: 2.0.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-30 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
|