phony 1.6.1 → 1.6.2

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.
@@ -2,6 +2,12 @@
2
2
  #
3
3
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Italy
4
4
  #
5
+
6
+ ndcs_2digit = [
7
+ '02', # Milan
8
+ '06', # Rome (including State of Vatican City) and Aprilia
9
+ ]
10
+
5
11
  ndcs = [
6
12
  '010', # Genoa
7
13
  '011', # Turin
@@ -17,7 +23,6 @@ ndcs = [
17
23
  '0185', # Tigullio
18
24
  '0187', # La Spezia and Cinque Terre
19
25
  '019', # Savona
20
- '02', # Milan
21
26
  '030', # Brescia
22
27
  '031', # Como
23
28
  '0321', # Novara
@@ -53,7 +58,6 @@ ndcs = [
53
58
  '0577', # Siena
54
59
  '0586', # Livorno
55
60
  '059', # Modena
56
- '06', # Rome (including State of Vatican City) and Aprilia
57
61
  '070', # Cagliari
58
62
  '071', # Ancona
59
63
  '075', # Perugia
@@ -168,6 +172,11 @@ handlers << Phony::NationalCode.new(
168
172
  Phony::LocalSplitters::Fixed.instance_for([3, 4]),
169
173
  false
170
174
  )
175
+ handlers << Phony::NationalCode.new(
176
+ Phony::NationalSplitters::Variable.new(nil, ndcs_2digit),
177
+ Phony::LocalSplitters::Fixed.instance_for([4, 4]),
178
+ false
179
+ )
171
180
  handlers << Phony::NationalCode.new(
172
181
  Phony::NationalSplitters::Variable.new(3, ndcs),
173
182
  Phony::LocalSplitters::Fixed.instance_for([3, 4]),
@@ -112,8 +112,8 @@ describe 'country descriptions' do
112
112
  Phony.split('3545511234').should == ['354', '551', '1234'] # Reykjavík
113
113
  end
114
114
  it 'handles italian numbers' do
115
- Phony.split('3934869528').should == ['39', '3486', '952', '8'] # Mobile
116
- Phony.split('39068546705').should == ['39', '06', '854', '6705'] # Roma
115
+ Phony.split('3934869528').should == ['39', '3486', '952', '8'] # Mobile
116
+ Phony.split('390612341234').should == ['39', '06', '1234', '1234'] # Roma
117
117
  Phony.split('390909709511').should == ['39', '090', '970', '9511'] # Barcellona
118
118
  end
119
119
  it 'handles kenyan numbers' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-25 00:00:00.000000000 Z
12
+ date: 2012-01-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Fast international phone number (E164 standard) normalizing, splitting
15
15
  and formatting. Lots of formatting options: International (+.., 00..), national