tuk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +21 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/lib/area_codes.csv +612 -0
- data/lib/tuk.rb +57 -0
- data/test/helper.rb +18 -0
- data/test/test_tuk.rb +23 -0
- metadata +137 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.6.4"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.6.4)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.9.2)
|
10
|
+
rcov (0.9.10)
|
11
|
+
shoulda (2.11.3)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
bundler (~> 1.0.0)
|
18
|
+
jeweler (~> 1.6.4)
|
19
|
+
rcov
|
20
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Daniel Cooper
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= tuk
|
2
|
+
|
3
|
+
Tuk makes dealing with uk telephone numbers a little easier.
|
4
|
+
|
5
|
+
Tuk::Number.new('442089732951').area_code => '020'
|
6
|
+
|
7
|
+
== Contributing to tuk
|
8
|
+
|
9
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
10
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
11
|
+
* Fork the project
|
12
|
+
* Start a feature/bugfix branch
|
13
|
+
* Commit and push until you are happy with your contribution
|
14
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
15
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
16
|
+
|
17
|
+
== Copyright
|
18
|
+
|
19
|
+
Copyright (c) 2011 Daniel Cooper. See LICENSE.txt for
|
20
|
+
further details.
|
21
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "tuk"
|
18
|
+
gem.homepage = "http://github.com/danielcooper/tuk"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{A small library for sorting out uk telephone numbers}
|
21
|
+
gem.description = %Q{A small library for sorting out uk telephone numbers}
|
22
|
+
gem.email = "daniel@14lines.com"
|
23
|
+
gem.authors = ["Daniel Cooper"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "tuk #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/area_codes.csv
ADDED
@@ -0,0 +1,612 @@
|
|
1
|
+
Code,Ofcom Definition,Traditional BT Definition,Notes
|
2
|
+
0113,Leeds,Leeds,
|
3
|
+
0114,Sheffield,Sheffield,
|
4
|
+
0115,Nottingham,Nottingham,
|
5
|
+
0116,Leicester,Leicester,
|
6
|
+
0117,Bristol,Bristol Inner,
|
7
|
+
0118,Reading,Reading,
|
8
|
+
01200,Clitheroe,Clitheroe,
|
9
|
+
01202,Bournemouth,Bournemouth,
|
10
|
+
01204,Bolton,Bolton,
|
11
|
+
01205,Boston,Boston,
|
12
|
+
01206,Colchester,Colchester,
|
13
|
+
01207,Consett,Consett,
|
14
|
+
01208,Bodmin,Bodmin,
|
15
|
+
01209,Redruth,Redruth,
|
16
|
+
0121,Birmingham,Birmingham,
|
17
|
+
01223,Cambridge,Cambridge,
|
18
|
+
01224,Aberdeen,Aberdeen,
|
19
|
+
01225,Bath,Bath,
|
20
|
+
01226,Barnsley,Barnsley,
|
21
|
+
01227,Canterbury,Canterbury,
|
22
|
+
01228,Carlisle,Carlisle,
|
23
|
+
01229,Barrow-in Furness / Millom,Barrow-in Furness / Millom,
|
24
|
+
01233,Ashford (Kent),Ashford (Kent),
|
25
|
+
01234,Bedford,Bedford,
|
26
|
+
01235,Abingdon,Abingdon,
|
27
|
+
01236,Coatbridge,Coatbridge,
|
28
|
+
01237,Bideford,Bideford,
|
29
|
+
01239,Cardigan,Cardigan,
|
30
|
+
01241,Arbroath,Arbroath,
|
31
|
+
01242,Cheltenham,Cheltenham,
|
32
|
+
01243,Chichester,Chichester,
|
33
|
+
01244,Chester,Chester,
|
34
|
+
01245,Chelmsford,Chelmsford,
|
35
|
+
01246,Chesterfield,Chesterfield,
|
36
|
+
01248,Bangor (Gwynedd),Bangor (Gwynedd),
|
37
|
+
01249,Chippenham,Chippenham,
|
38
|
+
01250,Blairgowrie,Blairgowrie,
|
39
|
+
01252,Aldershot,Aldershot,
|
40
|
+
01253,Blackpool,Blackpool,
|
41
|
+
01254,Blackburn,Blackburn,
|
42
|
+
01255,Clacton-on-Sea,Clacton-on-Sea,
|
43
|
+
01256,Basingstoke,Basingstoke,
|
44
|
+
01257,Coppull,Coppull,
|
45
|
+
01258,Blandford,Blandford,
|
46
|
+
01259,Alloa,Alloa,
|
47
|
+
01260,Congleton,Congleton (see also 01477),
|
48
|
+
01261,Banff,Banff,
|
49
|
+
01262,Bridlington,Bridlington,
|
50
|
+
01263,Cromer,Cromer,
|
51
|
+
01264,Andover,Andover,
|
52
|
+
01267,Carmarthen,Carmarthen,
|
53
|
+
01268,Basildon,Stanford-le-Hope (see also 01375),
|
54
|
+
01269,Ammanford,Ammanford,
|
55
|
+
01270,Crewe,Crewe,
|
56
|
+
01271,Barnstaple,Barnstaple,
|
57
|
+
01273,Brighton,Brighton,
|
58
|
+
01274,Bradford,Bradford,
|
59
|
+
01275,Clevedon,Bristol Outer,
|
60
|
+
01276,Camberley,Ascot (see also 01344),
|
61
|
+
01277,Brentwood,Brentwood,
|
62
|
+
01278,Bridgwater,Bridgwater,
|
63
|
+
01279,Bishops Stortford,Bishops Stortford,
|
64
|
+
01280,Buckingham,Buckingham,
|
65
|
+
01282,Burnley,Burnley,
|
66
|
+
01283,Burton-on-Trent,Burton-on-Trent,
|
67
|
+
01284,Bury-St-Edmunds,Bury-St-Edmunds,
|
68
|
+
01285,Cirencester,Cirencester,
|
69
|
+
01286,Caernarvon,Caernarvon,
|
70
|
+
01287,Guisborough,Guisborough,
|
71
|
+
01288,Bude,Bude,
|
72
|
+
01289,Berwick-on-Tweed,Berwick-on-Tweed,
|
73
|
+
01290,Cumnock,Cumnock,
|
74
|
+
01291,Chepstow,Shirenewton,
|
75
|
+
01292,Ayr,Ayr,
|
76
|
+
01293,Crawley,Newdigate (see also 01306),
|
77
|
+
01294,Ardrossan,Ardrossan,
|
78
|
+
01295,Banbury,Banbury,
|
79
|
+
01296,Aylesbury,Aylesbury,
|
80
|
+
01297,Axminster,Axminster,
|
81
|
+
01298,Buxton,Buxton,
|
82
|
+
01299,Bewdley,Bewdley,
|
83
|
+
01300,Cerne Abbas,Cerne Abbas,
|
84
|
+
01301,Arrochar,Arrochar,
|
85
|
+
01302,Doncaster,Doncaster,
|
86
|
+
01303,Folkestone,Folkestone,
|
87
|
+
01304,Dover,Dover,
|
88
|
+
01305,Dorchester,Dorchester,
|
89
|
+
01306,Dorking,Newdigate (see also 01293),
|
90
|
+
01307,Forfar,Forfar,
|
91
|
+
01308,Bridport,Bridport,
|
92
|
+
01309,Forres,Forres,
|
93
|
+
0131,Edinburgh,Edinburgh,
|
94
|
+
01320,Fort Augustus,Fort Augustus,
|
95
|
+
01322,Dartford,Swanley (see also 01689 and 01959),
|
96
|
+
01323,Eastbourne,Eastbourne,
|
97
|
+
01324,Falkirk,Falkirk,
|
98
|
+
01325,Darlington,Darlington,
|
99
|
+
01326,Falmouth,Falmouth,
|
100
|
+
01327,Daventry,Weedon,
|
101
|
+
01328,Fakenham,Fakenham,
|
102
|
+
01329,Fareham,Fareham (see also 01489),
|
103
|
+
01330,Banchory,Banchory,
|
104
|
+
01332,Derby,Derby,
|
105
|
+
01333,Peat Inn,Peat Inn (see also 01334),
|
106
|
+
01334,St Andrews,Peat Inn (see also 01333),
|
107
|
+
01335,Ashbourne,Ashbourne,
|
108
|
+
01337,Ladybank,Ladybank,
|
109
|
+
01339,Aboyne / Ballater,Aboyne / Ballater,
|
110
|
+
01340,Craigellachie,Craigellachie,
|
111
|
+
01341,Barmouth,Barmouth,
|
112
|
+
01342,East Grinstead,East Grinstead,
|
113
|
+
01343,Elgin,Elgin,
|
114
|
+
01344,Bracknell,Ascot (see also 01276),
|
115
|
+
01346,Fraserburgh,Fraserburgh,
|
116
|
+
01347,Easingwold,Easingwold,
|
117
|
+
01348,Fishguard,Fishguard,
|
118
|
+
01349,Dingwall,Dingwall,
|
119
|
+
01350,Dunkeld,Dunkeld,
|
120
|
+
01352,Mold,Mold,
|
121
|
+
01353,Ely,Ely,
|
122
|
+
01354,Chatteris,Doddington,
|
123
|
+
01355,East Kilbride,East Kilbride (see also 01357),
|
124
|
+
01356,Brechin,Brechin,
|
125
|
+
01357,Strathaven,East Kilbride (see also 01355),
|
126
|
+
01358,Ellon,Ellon,
|
127
|
+
01359,Pakenham,Pakenham,
|
128
|
+
01360,Killearn,Killearn,
|
129
|
+
01361,Duns,Duns,
|
130
|
+
01362,Dereham,Dereham,
|
131
|
+
01363,Crediton,Crediton,
|
132
|
+
01364,Ashburton,Ashburton,
|
133
|
+
01366,Downham Market,Downham Market,
|
134
|
+
01367,Faringdon,Faringdon,
|
135
|
+
01368,Dunbar,Dunbar,
|
136
|
+
01369,Dunoon,Dunoon,
|
137
|
+
01371,Great Dunmow,Great Dunmow,
|
138
|
+
01372,Esher,Esher (see also 01932),
|
139
|
+
01373,Frome,Frome,
|
140
|
+
01375,Grays Thurrock,Stanford-le-Hope (see also 01268),
|
141
|
+
01376,Braintree,Braintree,
|
142
|
+
01377,Driffield,Driffield,
|
143
|
+
01379,Diss,Diss,
|
144
|
+
01380,Devizes,Devizes,
|
145
|
+
01381,Fortrose,Fortrose,
|
146
|
+
01382,Dundee,Dundee,
|
147
|
+
01383,Dunfermline,Dunfermline,
|
148
|
+
01384,Dudley,Stourbridge (see also 01562),
|
149
|
+
01386,Evesham,Evesham,
|
150
|
+
01387,Dumfries,Dumfries,
|
151
|
+
013873,Langholm,Langholm,
|
152
|
+
01388,Bishop Auckland / Stanhope,Bishop Auckland / Stanhope,
|
153
|
+
01389,Dumbarton,Dumbarton,
|
154
|
+
01392,Exeter,Exeter,
|
155
|
+
01394,Felixstowe,Shottisham,
|
156
|
+
01395,Budleigh Salterton,Budleigh Salterton,
|
157
|
+
01397,Fort William,Fort William,
|
158
|
+
01398,Dulverton,Dulverton,
|
159
|
+
01400,Honington,Honington,
|
160
|
+
01403,Horsham,Horsham,
|
161
|
+
01404,Honiton,Honiton,
|
162
|
+
01405,Goole,Goole,
|
163
|
+
01406,Holbeach,Holbeach,
|
164
|
+
01407,Holyhead,Holyhead,
|
165
|
+
01408,Golspie,Golspie,
|
166
|
+
01409,Holsworthy,Holsworthy,
|
167
|
+
0141,Glasgow,Glasgow,
|
168
|
+
01420,Alton,Alton,
|
169
|
+
01422,Halifax,Halifax,
|
170
|
+
01423,Boroughbridge / Harrogate,Boroughbridge / Harrogate,
|
171
|
+
01424,Hastings,Hastings,
|
172
|
+
01425,Ringwood,Burley,
|
173
|
+
01427,Gainsborough,Gainsborough,
|
174
|
+
01428,Haslemere,Haslemere,
|
175
|
+
01429,Hartlepool,Hartlepool,
|
176
|
+
01430,Market Weighton / North Cave,Market Weighton / North Cave,
|
177
|
+
01431,Helmsdale,Helmsdale,
|
178
|
+
01432,Hereford,Hereford,
|
179
|
+
01433,Hathersage,Hathersage,
|
180
|
+
01434,Bellingham / Haltwhistle / Hexham,Bellingham / Haltwhistle / Hexham,
|
181
|
+
01435,Heathfield,Heathfield,
|
182
|
+
01436,Helensburgh,Helensburgh,
|
183
|
+
01437,Clynderwen / Haverfordwest,Clynderwen / Haverfordwest,
|
184
|
+
01438,Stevenage,Knebworth (see also 01920),
|
185
|
+
01439,Helmsley,Helmsley,
|
186
|
+
01440,Haverhill,Haverhill,
|
187
|
+
01442,Hemel Hempstead,Markyate (see also 01582),
|
188
|
+
01443,Pontypridd,Pontypridd,
|
189
|
+
01444,Haywards Heath,Haywards Heath,
|
190
|
+
01445,Gairloch,Gairloch,
|
191
|
+
01446,Barry,Barry,
|
192
|
+
01449,Stowmarket,Stowmarket,
|
193
|
+
01450,Hawick,Hawick,
|
194
|
+
01451,Stow-on-the-Wold,Bourton-on-the-Water,
|
195
|
+
01452,Gloucester,Gloucester,
|
196
|
+
01453,Dursley,Dursley,
|
197
|
+
01454,Chipping Sodbury,Rangeworthy,
|
198
|
+
01455,Hinckley,Hinckley,
|
199
|
+
01456,Glenurquhart,Glenurquhart,
|
200
|
+
01457,Glossop,Glossop,
|
201
|
+
01458,Glastonbury,Glastonbury,
|
202
|
+
01460,Chard,Chard,
|
203
|
+
01461,Gretna,Annan,
|
204
|
+
01462,Hitchin,Hitchin,
|
205
|
+
01463,Inverness,Inverness,
|
206
|
+
01464,Insch,Insch,
|
207
|
+
01465,Girvan,Girvan,
|
208
|
+
01466,Huntly,Huntly,
|
209
|
+
01467,Inverurie,Inverurie,
|
210
|
+
01469,Killingholme,Killingholme,
|
211
|
+
01470,Isle of Skye Edinbane,Isle of Skye Edinbane,
|
212
|
+
01471,Isle of Skye Broadford,Isle of Skye Broadford,
|
213
|
+
01472,Grimsby,Grimsby,
|
214
|
+
01473,Ipswich,Ipswich,
|
215
|
+
01474,Gravesend,Gravesend,
|
216
|
+
01475,Greenock,Greenock,
|
217
|
+
01476,Grantham,Grantham,
|
218
|
+
01477,Holmes Chapel,Congleton (see also 01260),
|
219
|
+
01478,Isle of Skye Portree,Isle of Skye Portree,
|
220
|
+
01479,Grantown-on-Spey,Grantown-on-Spey,
|
221
|
+
01480,Huntingdon,Huntingdon,
|
222
|
+
01481,Guernsey,Guernsey,
|
223
|
+
01482,Hull,Hull,
|
224
|
+
01483,Guildford,Guildford,
|
225
|
+
01484,Huddersfield,Huddersfield,
|
226
|
+
01485,Hunstanton,Docking,
|
227
|
+
01487,Warboys,Warboys,
|
228
|
+
01488,Hungerford,Great Shefford,
|
229
|
+
01489,Bishops Waltham,Fareham (see also 01329),
|
230
|
+
01490,Corwen,Corwen,
|
231
|
+
01491,Henley-on-Thames,Nettlebed,
|
232
|
+
01492,Colwyn Bay,Colwyn Bay,
|
233
|
+
01493,Great Yarmouth,Great Yarmouth,
|
234
|
+
01494,High Wycombe,High Wycombe,
|
235
|
+
01495,Pontypool,Pontypool,
|
236
|
+
01496,Port Ellen,Port Ellen,
|
237
|
+
01497,Hay-on-Wye,Hay-on-Wye,
|
238
|
+
01499,Inveraray,Inveraray,
|
239
|
+
01501,Harthill,Harthill,
|
240
|
+
01502,Lowestoft,Lowestoft,
|
241
|
+
01503,Looe,Looe,
|
242
|
+
01505,Johnstone,Johnstone,
|
243
|
+
01506,Bathgate,Bathgate,
|
244
|
+
01507,Alford (Lincs) / Louth / Spilsby,Alford (Lincs) / Louth / Spilsby (see also 01790),Spilsby itself is actually 01790.
|
245
|
+
01508,Brooke,Brooke,
|
246
|
+
01509,Loughborough,Loughborough,
|
247
|
+
0151,Liverpool,Liverpool,
|
248
|
+
01520,Lochcarron,Lochcarron,
|
249
|
+
01522,Lincoln,Lincoln,
|
250
|
+
01524,Lancaster,Lancaster,
|
251
|
+
015242,Hornby,Hornby,
|
252
|
+
01525,Leighton Buzzard,Leighton Buzzard,
|
253
|
+
01526,Martin,Martin,
|
254
|
+
01527,Redditch,Redditch,
|
255
|
+
01528,Laggan,Laggan,
|
256
|
+
01529,Sleaford,Sleaford,
|
257
|
+
01530,Coalville,Coalville,
|
258
|
+
01531,Ledbury,Ledbury,
|
259
|
+
01534,Jersey,Jersey,
|
260
|
+
01535,Keighley,Keighley,
|
261
|
+
01536,Kettering,Kettering,
|
262
|
+
01538,Ipstones,Ipstones,
|
263
|
+
01539,Kendal,Kendal,
|
264
|
+
015394,Hawkshead,Hawkshead,
|
265
|
+
015395,Grange-Over-Sands,Grange-Over-Sands,
|
266
|
+
015396,Sedbergh,Sedbergh,
|
267
|
+
01540,Kingussie,Kingussie,
|
268
|
+
01542,Keith,Keith,
|
269
|
+
01543,Cannock,Burntwood,
|
270
|
+
01544,Kington,Kington,
|
271
|
+
01545,Llanarth,Llanarth,
|
272
|
+
01546,Lochgilphead,Lochgilphead,
|
273
|
+
01547,Knighton,Knighton,
|
274
|
+
01548,Kingsbridge,Kingsbridge,
|
275
|
+
01549,Lairg,Lairg,
|
276
|
+
01550,Llandovery,Llandovery,
|
277
|
+
01553,Kings Lynn,Kings Lynn,
|
278
|
+
01554,Llanelli,Llanelli,
|
279
|
+
01555,Lanark,Lanark,
|
280
|
+
01556,Castle Douglas,Castle Douglas,
|
281
|
+
01557,Kirkcudbright,Kirkcudbright,
|
282
|
+
01558,Llandeilo,Llandeilo,
|
283
|
+
01559,Llandysul,Llandysul,
|
284
|
+
01560,Moscow,Moscow,
|
285
|
+
01561,Laurencekirk,Fordoun,
|
286
|
+
01562,Kidderminster,Stourbridge (see also 01384),
|
287
|
+
01563,Kilmarnock,Kilmarnock,
|
288
|
+
01564,Lapworth,Lapworth,
|
289
|
+
01565,Knutsford,Knutsford,
|
290
|
+
01566,Launceston,Launceston,
|
291
|
+
01567,Killin,Killin,
|
292
|
+
01568,Leominster,Leominster,
|
293
|
+
01569,Stonehaven,Stonehaven,
|
294
|
+
01570,Lampeter,Lampeter,
|
295
|
+
01571,Lochinver,Lochinver,
|
296
|
+
01572,Oakham,Oakham,
|
297
|
+
01573,Kelso,Kelso,
|
298
|
+
01575,Kirriemuir,Kirriemuir,
|
299
|
+
01576,Lockerbie,Lockerbie,
|
300
|
+
01577,Kinross,Kinross,
|
301
|
+
01578,Lauder,Lauder,
|
302
|
+
01579,Liskeard,Liskeard,
|
303
|
+
01580,Cranbrook,Cranbrook,
|
304
|
+
01581,New Luce,New Luce,
|
305
|
+
01582,Luton,Markyate (see also 01442),
|
306
|
+
01583,Carradale,Carradale,
|
307
|
+
01584,Ludlow,Ludlow,
|
308
|
+
01586,Campbeltown,Campbeltown,
|
309
|
+
01588,Bishops Castle,Craven Arms,
|
310
|
+
01590,Lymington,Lymington,
|
311
|
+
01591,Llanwrtyd Wells,Llanwrtyd Wells,
|
312
|
+
01592,Kirkcaldy,Kirkcaldy,
|
313
|
+
01593,Lybster,Lybster,
|
314
|
+
01594,Lydney,Lydney,
|
315
|
+
01595,Lerwick / Foula / Fair Isle,Lerwick / Foula / Fair Isle,
|
316
|
+
01597,Llandrindod Wells,Llandrindod Wells,
|
317
|
+
01598,Lynton,Brayford,
|
318
|
+
01599,Kyle,Kyle,
|
319
|
+
01600,Monmouth,Monmouth,
|
320
|
+
01603,Norwich,Norwich,
|
321
|
+
01604,Northampton,Northampton,
|
322
|
+
01606,Northwich,Northwich,
|
323
|
+
01608,Chipping Norton,Chipping Norton,
|
324
|
+
01609,Northallerton,Northallerton,
|
325
|
+
0161,Manchester,Manchester,
|
326
|
+
01620,North Berwick,North Berwick,
|
327
|
+
01621,Maldon,Maldon,
|
328
|
+
01622,Maidstone,Maidstone,
|
329
|
+
01623,Mansfield,Mansfield,
|
330
|
+
01624,Isle of Man,Isle of Man,
|
331
|
+
01625,Macclesfield,Macclesfield,
|
332
|
+
01626,Newton Abbot,Newton Abbot,
|
333
|
+
01628,Maidenhead,Maidenhead,
|
334
|
+
01629,Matlock,Matlock,
|
335
|
+
01630,Market Drayton,Market Drayton,
|
336
|
+
01631,Oban,Oban,
|
337
|
+
01633,Newport,Newport,
|
338
|
+
01634,Medway,Medway,
|
339
|
+
01635,Newbury,Newbury,
|
340
|
+
01636,Newark,Newark,
|
341
|
+
01637,Newquay,Newquay (see also 01841),
|
342
|
+
01638,Newmarket,Newmarket,
|
343
|
+
01639,Neath,Neath,
|
344
|
+
01641,Strathy,Strathy,
|
345
|
+
01642,Middlesbrough,Middlesbrough,
|
346
|
+
01643,Minehead,Minehead,
|
347
|
+
01644,New Galloway,New Galloway,
|
348
|
+
01646,Milford Haven,Milford Haven,
|
349
|
+
01647,Moretonhampstead,Moretonhampstead,
|
350
|
+
01650,Cemmaes Road,Cemmaes Road,
|
351
|
+
01651,Oldmeldrum,Oldmeldrum,
|
352
|
+
01652,Brigg,Brigg,
|
353
|
+
01653,Malton,Malton,
|
354
|
+
01654,Machynlleth,Machynlleth,
|
355
|
+
01655,Maybole,Maybole,
|
356
|
+
01656,Bridgend,Bridgend,
|
357
|
+
01659,Sanquhar,Sanquhar,
|
358
|
+
01661,Prudhoe,Wylam,
|
359
|
+
01663,New Mills,New Mills,
|
360
|
+
01664,Melton Mowbray,Melton Mowbray,
|
361
|
+
01665,Alnwick,Alnwick,
|
362
|
+
01666,Malmesbury,Malmesbury,
|
363
|
+
01667,Nairn,Nairn,
|
364
|
+
01668,Bamburgh,Belford,
|
365
|
+
01669,Rothbury,Rothbury,
|
366
|
+
01670,Morpeth,Morpeth,
|
367
|
+
01671,Newton Stewart,Newton Stewart,
|
368
|
+
01672,Marlborough,Marlborough,
|
369
|
+
01673,Market Rasen,Market Rasen,
|
370
|
+
01674,Montrose,Montrose,
|
371
|
+
01675,Coleshill,Meriden (see also 01676),
|
372
|
+
01676,Meriden,Meriden (see also 01675),
|
373
|
+
01677,Bedale,Bedale,
|
374
|
+
01678,Bala,Bala,
|
375
|
+
01680,Isle of Mull Craignure,Isle of Mull Craignure,
|
376
|
+
01681,Isle of Mull Fionnphort,Isle of Mull Fionnphort,
|
377
|
+
01683,Moffat,Moffat,
|
378
|
+
01684,Malvern,Hanley Swan,
|
379
|
+
01685,Merthyr Tydfil,Merthyr Tydfil,
|
380
|
+
01686,Llanidloes / Newtown,Llanidloes / Newtown,
|
381
|
+
01687,Mallaig,Mallaig,
|
382
|
+
01688,Isle of Mull Tobermory,Isle of Mull Tobermory,
|
383
|
+
01689,Orpington,Swanley (see also 01322 and 01959),
|
384
|
+
01690,Betws-y-Coed,Betws-y-Coed,
|
385
|
+
01691,Oswestry,Oswestry,
|
386
|
+
01692,North Walsham,North Walsham,
|
387
|
+
01694,Church Stretton,Church Stretton,
|
388
|
+
01695,Skelmersdale,Rainford (see also 01744),
|
389
|
+
01697,Brampton,Brampton,"For new, 6 digit numbers"
|
390
|
+
016973,Wigton,Wigton,
|
391
|
+
016974,Raughton Head,Raughton Head,
|
392
|
+
016977,Brampton,Brampton,Original code for 4 and 5 digit numbers
|
393
|
+
01698,Motherwell,Motherwell,
|
394
|
+
01700,Rothesay,Rothesay,
|
395
|
+
01702,Southend-on-Sea,Southend-on-Sea,
|
396
|
+
01704,Southport,Southport,
|
397
|
+
01706,Rochdale,Rochdale,
|
398
|
+
01707,Welwyn Garden City,Colney Heath (see also 01727),
|
399
|
+
01708,Romford,Romford,
|
400
|
+
01709,Rotherham,Rotherham,
|
401
|
+
01720,Isles of Scilly,Scillonia,
|
402
|
+
01721,Peebles,Peebles,
|
403
|
+
01722,Salisbury,Salisbury,
|
404
|
+
01723,Scarborough,Scarborough,
|
405
|
+
01724,Scunthorpe,Scunthorpe,
|
406
|
+
01725,Rockbourne,Rockbourne,
|
407
|
+
01726,St Austell,St Austell,
|
408
|
+
01727,St Albans,Colney Heath (see also 01707),
|
409
|
+
01728,Saxmundham,Saxmundham,
|
410
|
+
01729,Settle,Settle,
|
411
|
+
01730,Petersfield,Petersfield,
|
412
|
+
01732,Sevenoaks,Sevenoaks,
|
413
|
+
01733,Peterborough,Peterborough,
|
414
|
+
01736,Penzance,Penzance,
|
415
|
+
01737,Redhill,Merstham (see also 01883),
|
416
|
+
01738,Perth,Perth,
|
417
|
+
01740,Sedgefield,Sedgefield,
|
418
|
+
01743,Shrewsbury,Shrewsbury,
|
419
|
+
01744,St Helens,Rainford (see also 01695),
|
420
|
+
01745,Rhyl,Rhyl,
|
421
|
+
01746,Bridgnorth,Bridgnorth,
|
422
|
+
01747,Shaftesbury,Shaftesbury,
|
423
|
+
01748,Richmond,Richmond,
|
424
|
+
01749,Shepton Mallet,Shepton Mallet,
|
425
|
+
01750,Selkirk,Selkirk,
|
426
|
+
01751,Pickering,Pickering,
|
427
|
+
01752,Plymouth,Plymouth,
|
428
|
+
01753,Slough,Iver (see also 01784 and 01895),
|
429
|
+
01754,Skegness,Skegness,
|
430
|
+
01756,Skipton,Skipton,
|
431
|
+
01757,Selby,Selby,
|
432
|
+
01758,Pwllheli,Pwllheli,
|
433
|
+
01759,Pocklington,Pocklington,
|
434
|
+
01760,Swaffham,Swaffham,
|
435
|
+
01761,Temple Cloud,Temple Cloud,
|
436
|
+
01763,Royston,Royston,
|
437
|
+
01764,Crieff,Crieff,
|
438
|
+
01765,Ripon,Ripon,
|
439
|
+
01766,Porthmadog,Porthmadog,
|
440
|
+
01767,Sandy,Sandy,
|
441
|
+
01768,Penrith,Penrith,
|
442
|
+
017683,Appleby,Appleby,
|
443
|
+
017684,Pooley Bridge,Pooley Bridge,
|
444
|
+
017687,Keswick,Keswick,
|
445
|
+
01769,South Molton,South Molton,
|
446
|
+
01770,Isle of Arran,Brodick,
|
447
|
+
01771,Maud,Maud,
|
448
|
+
01772,Preston,Preston,
|
449
|
+
01773,Ripley,Ripley,
|
450
|
+
01775,Spalding,Spalding,
|
451
|
+
01776,Stranraer,Stranraer,
|
452
|
+
01777,Retford,Retford,
|
453
|
+
01778,Bourne,Bourne,
|
454
|
+
01779,Peterhead,Peterhead,
|
455
|
+
01780,Stamford,Stamford,
|
456
|
+
01782,Stoke-on-Trent,Stoke-on-Trent,
|
457
|
+
01784,Staines,Iver (see also 01753 and 01895),
|
458
|
+
01785,Stafford,Stafford,
|
459
|
+
01786,Stirling,Stirling,
|
460
|
+
01787,Sudbury,Sudbury,
|
461
|
+
01788,Rugby,Rugby,
|
462
|
+
01789,Stratford-upon-Avon,Stratford-upon-Avon,
|
463
|
+
01790,Spilsby,Spilsby (see also 01507),
|
464
|
+
01792,Swansea,Swansea,
|
465
|
+
01793,Swindon,Swindon,
|
466
|
+
01794,Romsey,Romsey,
|
467
|
+
01795,Sittingbourne,Sittingbourne,
|
468
|
+
01796,Pitlochry,Pitlochry,
|
469
|
+
01797,Rye,Rye,
|
470
|
+
01798,Pulborough,Pulborough,
|
471
|
+
01799,Saffron Walden,Saffron Walden,
|
472
|
+
01803,Torquay,Torquay,
|
473
|
+
01805,Torrington,Torrington,
|
474
|
+
01806,Shetland,Voe,
|
475
|
+
01807,Ballindalloch,Coupar Angus (see also 01828),
|
476
|
+
01808,Tomatin,Tomatin,
|
477
|
+
01809,Tomdoun,Tomdoun,
|
478
|
+
01821,Kinrossie,Kinrossie,
|
479
|
+
01822,Tavistock,Tavistock,
|
480
|
+
01823,Taunton,Taunton,
|
481
|
+
01824,Ruthin,Ruthin,
|
482
|
+
01825,Uckfield,Uckfield,
|
483
|
+
01827,Tamworth,Tamworth,
|
484
|
+
01828,Coupar Angus,Coupar Angus (see also 01821),
|
485
|
+
01829,Tarporley,Tarporley,
|
486
|
+
01830,Kirkwhelpington,Kirkwhelpington,
|
487
|
+
01832,Clopton,Clopton,
|
488
|
+
01833,Barnard Castle,Barnard Castle,
|
489
|
+
01834,Narberth,Narberth,
|
490
|
+
01835,St Boswells,St Boswells,
|
491
|
+
01837,Okehampton,Okehampton,
|
492
|
+
01838,Dalmally,Dalmally,
|
493
|
+
01840,Camelford,Camelford,
|
494
|
+
01841,Newquay,Newquay (see also 01637),Actually for Padstow; Newquay uses 01637.
|
495
|
+
01842,Thetford,Thetford,
|
496
|
+
01843,Thanet,Thanet,
|
497
|
+
01844,Thame,Thame,
|
498
|
+
01845,Thirsk,Thirsk,
|
499
|
+
01847,Thurso / Tongue,Thurso / Tongue,
|
500
|
+
01848,Thornhill,Thornhill,
|
501
|
+
01851,Great Bernera / Stornoway,Great Bernera / Stornoway,
|
502
|
+
01852,Kilmelford,Kilmelford,
|
503
|
+
01854,Ullapool,Ullapool,
|
504
|
+
01855,Ballachulish,Ballachulish,
|
505
|
+
01856,Orkney,Kirkwall,
|
506
|
+
01857,Sanday,Sanday,
|
507
|
+
01858,Market Harborough,Market Harborough,
|
508
|
+
01859,Harris,Harris,
|
509
|
+
01862,Tain,Tain,
|
510
|
+
01863,Ardgay,Ardgay,
|
511
|
+
01864,Abington,Abington,
|
512
|
+
01865,Oxford,Oxford,
|
513
|
+
01866,Kilchrenan,Kilchrenan,
|
514
|
+
01869,Bicester,Bicester,
|
515
|
+
01870,Isle of Benbecula,Isle of Benbecula,
|
516
|
+
01871,Castlebay,Castlebay,
|
517
|
+
01872,Truro,Truro,
|
518
|
+
01873,Abergavenny,Abergavenny,
|
519
|
+
01874,Brecon,Brecon,
|
520
|
+
01875,Tranent,Tranent,
|
521
|
+
01876,Lochmaddy,Lochmaddy,
|
522
|
+
01877,Callandar,Trossachs,
|
523
|
+
01878,Lochboisdale,Lochboisdale,
|
524
|
+
01879,Scarinish,Scarinish,
|
525
|
+
01880,Tarbert,Tarbert,
|
526
|
+
01882,Kinloch Rannoch,Kinloch Rannoch,
|
527
|
+
01883,Caterham,Merstham (see also 01737),
|
528
|
+
01884,Tiverton,Tiverton,
|
529
|
+
01885,Pencombe,Bromyard (see also 01886),Also commonly used for neighbouring Bromyard instead of 01886.
|
530
|
+
01886,Bromyard,Bromyard (see also 01885),Generally used for rural area east of Bromyard; the town uses mostly 01885.
|
531
|
+
01887,Aberfeldy,Aberfeldy,
|
532
|
+
01888,Turriff,Turriff,
|
533
|
+
01889,Rugely,Dapple Heath,
|
534
|
+
01890,Ayton / Coldstream,Ayton / Coldstream,
|
535
|
+
01892,Tunbridge Wells,Tunbridge Wells,
|
536
|
+
01895,Uxbridge,Iver (see also 01753 and 01784),
|
537
|
+
01896,Galashiels,Galashiels,
|
538
|
+
01899,Biggar,Biggar,
|
539
|
+
01900,Workington,Workington,
|
540
|
+
01902,Wolverhampton,Wolverhampton (see also 01922),
|
541
|
+
01903,Worthing,Worthing,
|
542
|
+
01904,York,York,
|
543
|
+
01905,Worcester,Worcester,
|
544
|
+
01908,Milton Keynes,Wolverton,
|
545
|
+
01909,Worksop,Worksop,
|
546
|
+
0191,Tyneside / Durham / Sunderland,Tyneside / Wearside / Durham,
|
547
|
+
01920,Ware,Knebworth (see also 01438),
|
548
|
+
01922,Walsall,Wolverhampton (see also 01902),
|
549
|
+
01923,Watford,Watford,
|
550
|
+
01924,Wakefield,Wakefield,
|
551
|
+
01925,Warrington,Warrington,
|
552
|
+
01926,Warwick,Leamington Spa,
|
553
|
+
01928,Runcorn,Frodsham,
|
554
|
+
01929,Wareham,Wareham,
|
555
|
+
01931,Shap,Shap,
|
556
|
+
01932,Weybridge,Esher (see also 01372),
|
557
|
+
01933,Wellingborough,Wellingborough,
|
558
|
+
01934,Weston-Super-Mare,Weston-Super-Mare,
|
559
|
+
01935,Yeovil,Yeovil,
|
560
|
+
01937,Wetherby,Wetherby,
|
561
|
+
01938,Welshpool,Welshpool,
|
562
|
+
01939,Wem,Wem,
|
563
|
+
01942,Wigan,Wigan,
|
564
|
+
01943,Guiseley,Guiseley,
|
565
|
+
01944,West Heslerton,West Heslerton,
|
566
|
+
01945,Wisbech,Wisbech,
|
567
|
+
01946,Whitehaven,Whitehaven,
|
568
|
+
019467,Gosforth,Gosforth,
|
569
|
+
01947,Whitby,Whitby,
|
570
|
+
01948,Whitchurch,Whitchurch,
|
571
|
+
01949,Whatton,Whatton,
|
572
|
+
01950,Sandwick,Sandwick,
|
573
|
+
01951,Colonsay,Colonsay,
|
574
|
+
01952,Telford,Wellington,
|
575
|
+
01953,Wymondham,Attleborough,
|
576
|
+
01954,Madingley,Madingley,
|
577
|
+
01955,Wick,Wick,
|
578
|
+
01957,Mid Yell,Mid Yell,
|
579
|
+
01959,Westerham,Swanley (see also 01322 and 01689),
|
580
|
+
01962,Winchester,Winchester,
|
581
|
+
01963,Wincanton,Templecombe,
|
582
|
+
01964,Hornsea / Patrington,Hornsea / Patrington,
|
583
|
+
01967,Strontian,Strontian,
|
584
|
+
01968,Penicuik,Penicuik,
|
585
|
+
01969,Leyburn,Leyburn,
|
586
|
+
01970,Aberystwyth,Aberystwyth,
|
587
|
+
01971,Scourie,Scourie,
|
588
|
+
01972,Glenborrodale,Glenborrodale,
|
589
|
+
01974,Llanon,Llanon,
|
590
|
+
01975,Alford (Aberdeen) / Strathdon,Alford (Aberdeen) / Strathdon,
|
591
|
+
01977,Pontefract,Pontefract,
|
592
|
+
01978,Wrexham,Wrexham,
|
593
|
+
01980,Amesbury,Bulford Camp,
|
594
|
+
01981,Wormbridge,Wormbridge,
|
595
|
+
01982,Builth Wells,Builth Wells,
|
596
|
+
01983,Isle of Wight,Ryde,
|
597
|
+
01984,Watchet,Stogumber,
|
598
|
+
01985,Warminster,Warminster,
|
599
|
+
01986,Bungay,Bungay,
|
600
|
+
01987,Ebbsfleet,n/a (new code introduced in 2008),
|
601
|
+
01988,Wigtown,Wigtown,
|
602
|
+
01989,Ross-on-Wye,Ross-on-Wye,
|
603
|
+
01992,Lea Valley,Hoddesdon,
|
604
|
+
01993,Witney,Witney,
|
605
|
+
01994,St Clears,St Clears,
|
606
|
+
01995,Garstang,Garstang,
|
607
|
+
01997,Strathpeffer,Strathpeffer,
|
608
|
+
020,London,London,
|
609
|
+
023,Southampton / Portsmouth,Southampton / Portsmouth,
|
610
|
+
024,Coventry,Coventry,
|
611
|
+
028,Northern Ireland,Northern Ireland,
|
612
|
+
029,Cardiff,Cardiff,
|
data/lib/tuk.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Tuk
|
4
|
+
|
5
|
+
class Number
|
6
|
+
|
7
|
+
def initialize(with_number)
|
8
|
+
@original_number = with_number.gsub(" ", "")
|
9
|
+
end
|
10
|
+
|
11
|
+
def normalised_number
|
12
|
+
@_normalised_number ||= begin
|
13
|
+
self.class.remove_country_code(@original_number)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def area_code
|
18
|
+
self.class.area_code_for(normalised_number)
|
19
|
+
end
|
20
|
+
|
21
|
+
class << self
|
22
|
+
def remove_country_code(number)
|
23
|
+
if number[0..2] == "+44"
|
24
|
+
"0" + number[3..-1]
|
25
|
+
elsif number[0..1] == "44"
|
26
|
+
"0" + number[2..-1]
|
27
|
+
elsif number[0..3] == "0044"
|
28
|
+
"0" + number[4..-1]
|
29
|
+
else
|
30
|
+
number
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def area_code_for(number)
|
35
|
+
if matched = number.match(area_code_regex)
|
36
|
+
matched[1]
|
37
|
+
else
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def area_code_regex
|
43
|
+
@_area_code_regex || begin
|
44
|
+
Regexp.new("^(#{area_codes.join('|')}).*")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def area_codes
|
49
|
+
@_area_codes || begin
|
50
|
+
codes = CSV.read(File.dirname(__FILE__) + '/area_codes.csv').drop(1).map{|n| n.first}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'tuk'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_tuk.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/tuk.rb'
|
3
|
+
|
4
|
+
class TestTuk < Test::Unit::TestCase
|
5
|
+
def test_can_strip_country_code
|
6
|
+
assert_equal Tuk::Number.remove_country_code("442089732951"),"02089732951"
|
7
|
+
assert_equal Tuk::Number.remove_country_code("+442089732951"),"02089732951"
|
8
|
+
assert_equal Tuk::Number.remove_country_code("00442089732951"),"02089732951"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_knows_about_area_codes
|
12
|
+
assert Tuk::Number.area_codes.is_a? Array
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_can_generate_a_regex
|
16
|
+
assert Tuk::Number.area_code_regex.is_a? Regexp
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_can_get_area_code
|
20
|
+
assert_equal '020', Tuk::Number.area_code_for("02089732951")
|
21
|
+
assert_equal '020', Tuk::Number.new('442089732951').area_code
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tuk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Daniel Cooper
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-08-08 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :development
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
requirement: *id001
|
33
|
+
prerelease: false
|
34
|
+
name: shoulda
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
type: :development
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 23
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
version: 1.0.0
|
48
|
+
requirement: *id002
|
49
|
+
prerelease: false
|
50
|
+
name: bundler
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
type: :development
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 7
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 6
|
62
|
+
- 4
|
63
|
+
version: 1.6.4
|
64
|
+
requirement: *id003
|
65
|
+
prerelease: false
|
66
|
+
name: jeweler
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
type: :development
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
requirement: *id004
|
79
|
+
prerelease: false
|
80
|
+
name: rcov
|
81
|
+
description: A small library for sorting out uk telephone numbers
|
82
|
+
email: daniel@14lines.com
|
83
|
+
executables: []
|
84
|
+
|
85
|
+
extensions: []
|
86
|
+
|
87
|
+
extra_rdoc_files:
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.rdoc
|
90
|
+
files:
|
91
|
+
- .document
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.rdoc
|
96
|
+
- Rakefile
|
97
|
+
- VERSION
|
98
|
+
- lib/area_codes.csv
|
99
|
+
- lib/tuk.rb
|
100
|
+
- test/helper.rb
|
101
|
+
- test/test_tuk.rb
|
102
|
+
has_rdoc: true
|
103
|
+
homepage: http://github.com/danielcooper/tuk
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
version: "0"
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
version: "0"
|
129
|
+
requirements: []
|
130
|
+
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 1.4.2
|
133
|
+
signing_key:
|
134
|
+
specification_version: 3
|
135
|
+
summary: A small library for sorting out uk telephone numbers
|
136
|
+
test_files: []
|
137
|
+
|