phony 2.0.0.beta5 → 2.0.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWVhNDYzYzZjYTZiYTMzNjU0N2YwNzE5M2FkMzA2NmU2M2Q4N2EyYQ==
4
+ Mjc3MTQzMDcxZTgxYWJjYzhiODY5OTU5ZjNiYzc3MTIxYjdmMmI0Yw==
5
5
  data.tar.gz: !binary |-
6
- OTNkM2Q5NjQxNTliZjE1MmQxNjhkMDQ5NjhlZmI4NTRjN2MzNmZjYQ==
6
+ OTUzMjAxNDMwMmRhODAzMDZhNjA1YWVkMmI1ZDQ0MDhlMzc5MDU0ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWU4ZmQ5ZjFlMGJkNDI1OWNjOTJhNmI0NTlkNGMzYzcwMjcxYzFjNzJmMjg4
10
- YjUzYjQyMDg4ZjU2M2Y3OGEwZjExNDM0YTIyZDEwYzdiOTZhMGQ5NjQ0Mzk3
11
- ZWRmMWQwNTgxMTU2MzUxNmQyNmEwYzhlOWQ5NDNmNjQ2ZTY4ZjE=
9
+ NjdmYTJkOTk1NjA1NmNjNmExNDI2OWU4YTAyNTQ2ZWQyMjUwMmVmYWZkM2Vi
10
+ ODA1YTMzOWY3ZGJjNGFhOWRkYTM2M2MxZWVhZDZjOTlkMWQ5Y2QzZTdkZjZl
11
+ YzQxNzM5NDM2MWIzMWQxODBhNGQwOTc4MTYwYmM1MjFjY2FmYmE=
12
12
  data.tar.gz: !binary |-
13
- YzAxOTUxMDg3YzViNTZjMDBlYjgyYzk4MzUwY2E3OTkyZjZkNmZiMzI4YTc3
14
- MGZhYWQ5ODZhZmRmMzZhNzVhODdlNmRhZThhZmFjM2JlOGYxOTY1YjUzMmQ4
15
- NWI1YTg1ZWNjYzY2YzNhOGY5NjA5NTgzMDA2NjUzZTJmOGNiM2I=
13
+ NWI3MTg5Zjc3NGI4ODFjZWY4NDViYzAxMjhlYmRiZTk1NjYwY2MzY2VjZTRm
14
+ NTg3YjgzNTQwN2U4ZmJlOTQxMGIyNDgxOWU3YjZhMWQ0ZWUwOWIwODc2Yzhm
15
+ ODI1Yjk2MTE2YjhiYWE2ZTM1ZDlmNDNmOGE2MDViMGRmMDU5M2U=
@@ -207,10 +207,9 @@ Phony.define do
207
207
 
208
208
  # New Zealand.
209
209
  #
210
- # TODO Mobile?
211
- #
212
210
  country '64',
213
- fixed(1) >> split(3,4)
211
+ match(/^(2\d)\d+$/) >> split(3,4) | # Mobile
212
+ fixed(1) >> split(3,4) # Rest
214
213
 
215
214
  # Singapore (Republic of).
216
215
  #
@@ -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(929 995344 9971 99744 9976 997)) >> trunk('8') >> split(2, 2, 2) | # South Osetia
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
@@ -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.beta5
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-27 00:00:00.000000000 Z
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