phony 2.18.3 → 3.0.3

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +117 -0
  3. data/lib/phony/config.rb +25 -26
  4. data/lib/phony/countries/argentina.rb +352 -0
  5. data/lib/phony/countries/austria.rb +73 -74
  6. data/lib/phony/countries/bangladesh.rb +27 -28
  7. data/lib/phony/countries/belarus.rb +110 -111
  8. data/lib/phony/countries/brazil.rb +93 -93
  9. data/lib/phony/countries/cambodia.rb +10 -14
  10. data/lib/phony/countries/china.rb +22 -18
  11. data/lib/phony/countries/croatia.rb +6 -5
  12. data/lib/phony/countries/georgia.rb +84 -84
  13. data/lib/phony/countries/germany.rb +4067 -4068
  14. data/lib/phony/countries/guinea.rb +8 -8
  15. data/lib/phony/countries/india.rb +31 -34
  16. data/lib/phony/countries/indonesia.rb +57 -46
  17. data/lib/phony/countries/ireland.rb +10 -9
  18. data/lib/phony/countries/italy.rb +79 -60
  19. data/lib/phony/countries/japan.rb +456 -406
  20. data/lib/phony/countries/kyrgyzstan.rb +109 -109
  21. data/lib/phony/countries/latvia.rb +34 -34
  22. data/lib/phony/countries/libya.rb +109 -107
  23. data/lib/phony/countries/malaysia.rb +12 -12
  24. data/lib/phony/countries/moldova.rb +42 -42
  25. data/lib/phony/countries/montenegro.rb +24 -20
  26. data/lib/phony/countries/myanmar.rb +39 -39
  27. data/lib/phony/countries/namibia.rb +35 -29
  28. data/lib/phony/countries/nepal.rb +60 -62
  29. data/lib/phony/countries/netherlands.rb +13 -13
  30. data/lib/phony/countries/pakistan.rb +135 -111
  31. data/lib/phony/countries/paraguay.rb +135 -135
  32. data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
  33. data/lib/phony/countries/saudi_arabia.rb +5 -5
  34. data/lib/phony/countries/serbia.rb +48 -36
  35. data/lib/phony/countries/somalia.rb +18 -18
  36. data/lib/phony/countries/south_korea.rb +16 -13
  37. data/lib/phony/countries/sweden.rb +356 -48
  38. data/lib/phony/countries/taiwan.rb +20 -18
  39. data/lib/phony/countries/tajikistan.rb +70 -70
  40. data/lib/phony/countries/turkmenistan.rb +65 -65
  41. data/lib/phony/countries/ukraine.rb +607 -607
  42. data/lib/phony/countries/united_kingdom.rb +66 -66
  43. data/lib/phony/countries/uruguay.rb +40 -41
  44. data/lib/phony/countries/vietnam.rb +20 -14
  45. data/lib/phony/countries/zimbabwe.rb +31 -31
  46. data/lib/phony/countries.rb +509 -453
  47. data/lib/phony/country.rb +50 -44
  48. data/lib/phony/country_codes.rb +77 -57
  49. data/lib/phony/dsl.rb +25 -28
  50. data/lib/phony/local_splitters/fixed.rb +24 -29
  51. data/lib/phony/local_splitters/regex.rb +30 -31
  52. data/lib/phony/national_code.rb +7 -10
  53. data/lib/phony/national_splitters/default.rb +9 -11
  54. data/lib/phony/national_splitters/dsl.rb +8 -18
  55. data/lib/phony/national_splitters/fixed.rb +12 -15
  56. data/lib/phony/national_splitters/none.rb +8 -14
  57. data/lib/phony/national_splitters/regex.rb +13 -17
  58. data/lib/phony/national_splitters/variable.rb +37 -38
  59. data/lib/phony/trunk_code.rb +23 -23
  60. data/lib/phony/vanity.rb +12 -13
  61. data/lib/phony.rb +84 -83
  62. metadata +14 -45
  63. data/README.textile +0 -112
  64. data/spec/functional/config_spec.rb +0 -44
  65. data/spec/functional/plausibility_spec.rb +0 -608
  66. data/spec/lib/phony/countries_spec.rb +0 -1391
  67. data/spec/lib/phony/country_codes_spec.rb +0 -203
  68. data/spec/lib/phony/country_spec.rb +0 -84
  69. data/spec/lib/phony/dsl_spec.rb +0 -24
  70. data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
  71. data/spec/lib/phony/local_splitters/regex_spec.rb +0 -97
  72. data/spec/lib/phony/national_code_spec.rb +0 -91
  73. data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
  74. data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -49
  75. data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
  76. data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
  77. data/spec/lib/phony/national_splitters/variable_spec.rb +0 -39
  78. data/spec/lib/phony/vanity_spec.rb +0 -30
  79. data/spec/lib/phony_spec.rb +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f999191cc1bc0a50f69f2330b8b9abacf7c27223460b27b83fa12e7921e38e3
4
- data.tar.gz: 34262181d5b43964268f916e88e98c989b12265af7cf739e11fc45b5e0a0f293
3
+ metadata.gz: 791dda58c1a448a35162db9f85af9fd103500e3120796c04d60c0a190773a9b7
4
+ data.tar.gz: 27933aabd62b90068779bc6d3ba4bbbecb64fbc24ffea12b00accbe00f790aaa
5
5
  SHA512:
6
- metadata.gz: a8105b14ad360a98f86c85b9c9ef4e4ab616c749d6aa1ec2d09d732cce8a5cc6c0cc98a005cb7bd82f39da2e6452e48f0a4b3bb677c055b124f872cbd45d0c66
7
- data.tar.gz: 1ab16b6d15ba9a13cfb0d72b6073b24d3009db8c60282b1d9b44321674d9db6117885e0043c6eaad721eb7bc93de514a05fbcdb59c69b6b8f1ec7c1caeeaeacb
6
+ metadata.gz: 61a2344d76eb13b2660803ea4c0f89a01171fdb2e314cffda9b5229c26aa5586a72a3f7c407e525170159783e719b40aae6f3d4822254e082f2e42faa8cb0266
7
+ data.tar.gz: 2eaeb27b07f7ddf7b9291f1deb6f09cff24b1cdd7d00f4086a4f951d26c98e4605570cc7309e8159ff04090fd4cac7f0ac09be95f1017050ff2a685f389558b9
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ [![Build Status](https://secure.travis-ci.org/floere/phony.png)](http://travis-ci.org/floere/phony)
2
+ [![Coverage Status](https://coveralls.io/repos/floere/phony/badge.svg?branch=master)](https://coveralls.io/r/floere/phony?branch=master)
3
+ [![Code Climate](https://codeclimate.com/github/floere/phony.png)](https://codeclimate.com/github/floere/phony)
4
+ [![Inline docs](http://inch-ci.org/github/floere/phony.png)](http://inch-ci.org/github/floere/phony)
5
+
6
+ # Phony
7
+
8
+ Disclaimer: Phony works with international numbers only, such as `61 412 345 678`!
9
+
10
+ The (admittedly crazy) goal of this Gem is to be able to normalize/format/split all phone numbers in the world.
11
+
12
+ Used in: [airbnb.com](http://airbnb.com), [socialcam.com](http://socialcam.com), [zendesk.com](http://www.zendesk.com/) (and many, many others).
13
+
14
+ ## Runtime Memory Usage {#memory}
15
+
16
+ According to [memory_profiler](https://github.com/SamSaffron/memory_profiler), the Phony gem uses roughly 1MB of memory per Ruby process.
17
+ Usage was generated using (look for `Total retained`): `ruby -e 'require "memory_profiler"; MemoryProfiler.report(allow_files: "phony"){ require "phony" }.pretty_print'`
18
+
19
+ ## Description
20
+
21
+ This gem normalizes, formats and splits "**E164 phone numbers**". A valid E164 phone number **must** include a country code.
22
+
23
+ E164 numbers are international numbers with a country dial prefix, usually an area code and a subscriber number. For example, the Australian number `+61 412 345 678` can be broken down into the following components:
24
+ * Country Code (CC): a country code of `61`
25
+ * National Destination Code (NDC): a mobile number denoted by the `4` (specific to Australia)
26
+ * Local Number Part: a subscriber number of `12 345 678`
27
+
28
+ It currently handles the countries listed at the end of this README.
29
+
30
+ It is covered by roughly 2,250 tests that run in 2 seconds (April 2019).
31
+ If it doesn't work, please [enter an issue](http://github.com/floere/phony/issues) or better, fork and [send a pull request](http://github.com/floere/phony/pulls).
32
+
33
+ ## Installation
34
+
35
+ With Rails? Check out: https://github.com/joost/phony_rails.
36
+
37
+ With Bundler: Append `gem 'phony'` to your `Gemfile` and `bundle install` it.
38
+
39
+ Without Bundler: Run `gem install phony` from your command line.
40
+
41
+ ## Usage docs {#usage}
42
+
43
+ Phony uses [qed](https://github.com/rubyworks/qed) as docs and to run its functional tests. Start here for usage docs: [Usage index](./qed/index.md).
44
+
45
+ ### Phony.normalize(number) {#normalizing}
46
+
47
+ Normalize intelligently removes all non-numeric characters of a number. Do it before storing a number in a DB.
48
+
49
+ [Phony.normalize docs](./qed/normalize.md)
50
+
51
+ `Phony.normalize('1-888-407-4747').assert == '18884074747'`
52
+
53
+ ### Phony.format(number, options = {}) {#formatting}
54
+
55
+ Format formats a normalized number according to a country's predominant formatting. Lots of options for int'l, national, local formatting.
56
+
57
+ [Phony.format docs](./qed/format.md)
58
+
59
+ `Phony.format('41443643532').assert == '+41 44 364 35 32'`
60
+
61
+ ### Phony.plausible?(number, options = {}) {#plausibility}
62
+
63
+ Is a number plausible?
64
+
65
+ [Phony.plausible? docs](./qed/plausibility.md)
66
+
67
+ `Phony.assert.plausible?('+41 44 111 22 33')`
68
+
69
+ ### Phony.split(number) {#splitting}
70
+
71
+ Split a number into its parts: CC, NDC, local.
72
+
73
+ [Phony.split docs](./qed/split.md)
74
+
75
+ `Phony.split('3928061371').assert == ['39', '2', '806', '1371']`
76
+
77
+ NB If a country does not have an NDC, `#split` will return `false` in the NDC position, for example for Denmark:
78
+
79
+ `Phony.split('4512121212').assert == ['45', false, '12', '12', '12', '12']`
80
+
81
+ ### Loading only a country subset (Phony 2.18.0+). {#loading}
82
+
83
+ Use this in case you'd like to save [memory](#memory) that is used by Phony's CC rules.
84
+
85
+ [Phony::Config.load docs](./qed/config.md)
86
+
87
+ First, `require 'phony/config'`.
88
+ Then, one of the following, which will load the rest of Phony.
89
+
90
+ Load only these CCs:
91
+ `Phony::Config.load(only: ['41', '44'])`
92
+
93
+ Loads everything except these CCs:
94
+ `Phony::Config.load(except: ['41', '44'])`
95
+
96
+ Convenience form of `only`:
97
+ `Phony::Config.load('41', '44')`
98
+
99
+ Each of these loads the rest of Phony.
100
+
101
+ Memory usage can be checked using (look for `Total retained`):
102
+ `ruby -e 'require "memory_profiler"; MemoryProfiler.report(allow_files: "phony"){ require "phony/config"; Phony::Config.load("1") }.pretty_print'`
103
+ For example, when just loading the NANP CC, the retained memory usage is ~63kB.
104
+
105
+ ## List of Handled Countries
106
+
107
+ Mildly unmaintained list: Abhas, Afghan, Algerian, Argentina, Austrian, Australian, Azerbaijani, Belgian, Brazilian, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, El Salvadorian, Estonian, French, German, Ghanan, Gibraltar, Greek, Haiti, Hong Kong, Hungarian, Indian, Iran, Irish, Israel, Italian, Japanese, Kazakh, Liberian, Lithuanian, Luxembourgian, Malaysian, Malta, Mauritian, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, Seychelles, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sri Lankan, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, Vietnamese, and Zambian numbers.
108
+
109
+ ## Proud Sponsors
110
+
111
+ * Renuo AG (July 2022 – January 2025): [Github](https://github.com/renuo), [Homepage](https://www.renuo.ch). Much appreciated!
112
+
113
+ ## License
114
+
115
+ MIT.
116
+ See [LICENSE](./LICENSE) file.
117
+
data/lib/phony/config.rb CHANGED
@@ -1,53 +1,53 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phony
4
-
5
4
  # Add config.
6
5
  class << self
7
6
  attr_writer :config
8
-
7
+
9
8
  def config
10
9
  # Default config includes all CCs.
11
10
  @config ||= Config.new([], [])
12
11
  end
13
12
  end
14
-
13
+
15
14
  # The Config class is only used to configure Phony and to load specific
16
15
  # subsets of CCs.
17
16
  #
18
17
  class Config
19
-
20
18
  attr_reader :included_ccs, :excluded_ccs
21
-
22
- def initialize included_ccs, excluded_ccs
19
+
20
+ def initialize(included_ccs, excluded_ccs)
23
21
  @included_ccs = included_ccs || []
24
22
  @excluded_ccs = excluded_ccs || []
25
23
  end
26
-
27
- def load? cc
24
+
25
+ def load?(cc)
28
26
  return false if has_excluded? && excluded_ccs.include?(cc)
29
-
27
+
30
28
  if has_included?
31
29
  # We have to check the included_ccs, otherwise false.
32
30
  return true if included_ccs.include?(cc)
33
-
31
+
34
32
  false
35
33
  else
36
34
  # It's not in excluded and no included was given.
37
35
  true
38
36
  end
39
37
  end
38
+
40
39
  def has_included?
41
40
  !included_ccs.empty?
42
41
  end
42
+
43
43
  def has_excluded?
44
44
  !excluded_ccs.empty?
45
45
  end
46
-
46
+
47
47
  # Use as follows:
48
48
  #
49
49
  # require 'phony/config'
50
- #
50
+ #
51
51
  # # Load only these:
52
52
  # Phony::Config.load(only: ['41', '44'])
53
53
  # # or all except these:
@@ -61,31 +61,30 @@ module Phony
61
61
  # Extract options.
62
62
  last = options.last
63
63
  only, except = if last.respond_to?(:to_hash)
64
- # We have the explicit form.
65
- [last[:only], last[:except]]
66
- elsif options.respond_to?(:to_ary)
67
- # We have the convenience short forms.
68
- [options, []]
69
- end
70
-
64
+ # We have the explicit form.
65
+ [last[:only], last[:except]]
66
+ elsif options.respond_to?(:to_ary)
67
+ # We have the convenience short forms.
68
+ [options, []]
69
+ end
70
+
71
71
  # Set defaults.
72
72
  only, except = [only || [], except || []]
73
73
  # Convert to expected format if possible.
74
74
  only, except = [only.map(&:to_s), except.map(&:to_s)]
75
-
75
+
76
76
  # Check params.
77
77
  raise "Params given to Phony::Config.load must be Array-like. The one given was: #{only}" unless only.respond_to?(:to_ary)
78
78
  raise "Params given to Phony::Config.load must be Array-like. The one given was: #{except}" unless except.respond_to?(:to_ary)
79
-
79
+
80
80
  # Configure Phony.
81
81
  Phony.config = new(only, except)
82
-
82
+
83
83
  # Load phony.
84
- Kernel.load File.expand_path('../../phony.rb', __FILE__)
85
-
84
+ Kernel.load File.expand_path('../phony.rb', __dir__)
85
+
86
86
  # Return the stored config data.
87
87
  Phony.config
88
88
  end
89
-
90
89
  end
91
- end
90
+ end
@@ -0,0 +1,352 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Argentinian numbers are all ten digits long.
4
+ # Information taken from:
5
+ # https://www.enacom.gob.ar/multimedia/normativas/1997/Resolucion%2046_97.pdf
6
+ # http://www.wtng.info/wtng-54-ar.html
7
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Argentina
8
+ # Area codes collected from https://www.enacom.gob.ar/indicativos-interurbanos_p366 (06/27/19)
9
+
10
+ # Landline
11
+ area_codes_2digits = [
12
+ '11'
13
+ ]
14
+
15
+ area_codes_3digits = %w[
16
+ 220
17
+ 221
18
+ 223
19
+ 230
20
+ 236
21
+ 237
22
+ 249
23
+ 260
24
+ 261
25
+ 263
26
+ 264
27
+ 266
28
+ 280
29
+ 291
30
+ 294
31
+ 297
32
+ 298
33
+ 299
34
+ 336
35
+ 341
36
+ 342
37
+ 343
38
+ 345
39
+ 348
40
+ 351
41
+ 353
42
+ 358
43
+ 362
44
+ 364
45
+ 370
46
+ 376
47
+ 379
48
+ 380
49
+ 381
50
+ 383
51
+ 385
52
+ 387
53
+ 388
54
+ ]
55
+
56
+ area_codes_4digits = %w[
57
+ 2202
58
+ 2221
59
+ 2223
60
+ 2224
61
+ 2225
62
+ 2226
63
+ 2227
64
+ 2229
65
+ 2241
66
+ 2242
67
+ 2243
68
+ 2244
69
+ 2245
70
+ 2246
71
+ 2252
72
+ 2254
73
+ 2255
74
+ 2257
75
+ 2261
76
+ 2262
77
+ 2264
78
+ 2265
79
+ 2266
80
+ 2267
81
+ 2268
82
+ 2271
83
+ 2272
84
+ 2273
85
+ 2274
86
+ 2281
87
+ 2283
88
+ 2284
89
+ 2285
90
+ 2286
91
+ 2291
92
+ 2292
93
+ 2296
94
+ 2297
95
+ 2302
96
+ 2314
97
+ 2316
98
+ 2317
99
+ 2320
100
+ 2323
101
+ 2324
102
+ 2325
103
+ 2326
104
+ 2331
105
+ 2333
106
+ 2334
107
+ 2335
108
+ 2336
109
+ 2337
110
+ 2338
111
+ 2342
112
+ 2343
113
+ 2344
114
+ 2345
115
+ 2346
116
+ 2352
117
+ 2353
118
+ 2354
119
+ 2355
120
+ 2356
121
+ 2357
122
+ 2358
123
+ 2392
124
+ 2393
125
+ 2394
126
+ 2395
127
+ 2396
128
+ 2473
129
+ 2474
130
+ 2475
131
+ 2477
132
+ 2478
133
+ 2622
134
+ 2624
135
+ 2625
136
+ 2626
137
+ 2646
138
+ 2647
139
+ 2648
140
+ 2651
141
+ 2655
142
+ 2656
143
+ 2657
144
+ 2658
145
+ 2901
146
+ 2902
147
+ 2903
148
+ 2920
149
+ 2921
150
+ 2922
151
+ 2923
152
+ 2924
153
+ 2925
154
+ 2926
155
+ 2927
156
+ 2928
157
+ 2929
158
+ 2931
159
+ 2932
160
+ 2933
161
+ 2934
162
+ 2935
163
+ 2936
164
+ 2940
165
+ 2942
166
+ 2945
167
+ 2946
168
+ 2948
169
+ 2952
170
+ 2953
171
+ 2954
172
+ 2962
173
+ 2963
174
+ 2964
175
+ 2966
176
+ 2972
177
+ 2982
178
+ 2983
179
+ 3327
180
+ 3329
181
+ 3382
182
+ 3385
183
+ 3387
184
+ 3388
185
+ 3400
186
+ 3401
187
+ 3402
188
+ 3404
189
+ 3405
190
+ 3406
191
+ 3407
192
+ 3408
193
+ 3409
194
+ 3435
195
+ 3436
196
+ 3437
197
+ 3438
198
+ 3442
199
+ 3444
200
+ 3445
201
+ 3446
202
+ 3447
203
+ 3454
204
+ 3455
205
+ 3456
206
+ 3458
207
+ 3460
208
+ 3462
209
+ 3463
210
+ 3464
211
+ 3465
212
+ 3466
213
+ 3467
214
+ 3468
215
+ 3469
216
+ 3471
217
+ 3472
218
+ 3476
219
+ 3482
220
+ 3483
221
+ 3487
222
+ 3489
223
+ 3491
224
+ 3492
225
+ 3493
226
+ 3496
227
+ 3497
228
+ 3498
229
+ 3521
230
+ 3522
231
+ 3524
232
+ 3525
233
+ 3532
234
+ 3533
235
+ 3537
236
+ 3541
237
+ 3542
238
+ 3543
239
+ 3544
240
+ 3546
241
+ 3547
242
+ 3548
243
+ 3549
244
+ 3562
245
+ 3563
246
+ 3564
247
+ 3571
248
+ 3572
249
+ 3573
250
+ 3574
251
+ 3575
252
+ 3576
253
+ 3582
254
+ 3583
255
+ 3584
256
+ 3585
257
+ 3711
258
+ 3715
259
+ 3716
260
+ 3718
261
+ 3721
262
+ 3725
263
+ 3731
264
+ 3734
265
+ 3735
266
+ 3741
267
+ 3743
268
+ 3751
269
+ 3754
270
+ 3755
271
+ 3756
272
+ 3757
273
+ 3758
274
+ 3772
275
+ 3773
276
+ 3774
277
+ 3775
278
+ 3777
279
+ 3781
280
+ 3782
281
+ 3786
282
+ 3821
283
+ 3825
284
+ 3826
285
+ 3827
286
+ 3832
287
+ 3835
288
+ 3837
289
+ 3838
290
+ 3841
291
+ 3843
292
+ 3844
293
+ 3845
294
+ 3846
295
+ 3854
296
+ 3855
297
+ 3856
298
+ 3857
299
+ 3858
300
+ 3861
301
+ 3862
302
+ 3863
303
+ 3865
304
+ 3867
305
+ 3868
306
+ 3869
307
+ 3873
308
+ 3876
309
+ 3877
310
+ 3878
311
+ 3885
312
+ 3886
313
+ 3887
314
+ 3888
315
+ 3891
316
+ 3892
317
+ 3894
318
+ ]
319
+
320
+ # Mobile
321
+ # Mobile phone numbers in Argentina are assigned the same geographic area codes as fixed lines,
322
+ # according to the subscriber's choice or residence, and can be 6, 7 or 8 digits long, just as
323
+ # landline numbers are. The difference with landline numbers is that a prefix 15, never used for
324
+ # landlines, must be dialed.
325
+
326
+ # International: +54 + 9 + area code + subscriber number (without '15' prefix)
327
+ # Domestic: area code + 15 + subscriber number
328
+ # Mobile numbers in Argentina may be listed as 15-xxxxxxx. However, the leading '15'
329
+ # is a domestic prefix which must be omitted when calling these from outside Argentina,
330
+ # with the xxxxxxx being the actual subscriber number portion.
331
+
332
+ # Non-geographic numbers 0ppp-nnn-nnnn
333
+ special_numbers = [
334
+ '800', # toll-free telephone numbers
335
+ '810', # calls from any area chargeable at local rate
336
+ '822', # toll-free numbers used for calling card access
337
+ '600', # premium-rate telephone numbers
338
+ '609', # premium, fixed-rate gaming numbers
339
+ '610', # dial-up Internet access numbers, usually cheaper than a local call, less frequently used as dial-up Internet access decreased
340
+ '605' # premium-rate telephone numbers for charity donations
341
+ ]
342
+
343
+ Phony.define do
344
+ country '54', trunk('0') |
345
+ one_of(area_codes_4digits) >> split(2, 4) | # landline
346
+ one_of(area_codes_3digits) >> split(3, 4) | # landline
347
+ one_of(area_codes_2digits) >> split(4, 4) | # landline
348
+ one_of(area_codes_2digits.map { |x| "9#{x}" }) >> split(4, 4) | # mobile
349
+ one_of(area_codes_3digits.map { |x| "9#{x}" }) >> split(3, 4) | # mobile
350
+ one_of(area_codes_4digits.map { |x| "9#{x}" }) >> split(2, 4) | # mobile
351
+ one_of(special_numbers) >> split(3, 4)
352
+ end