dialy 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +0 -1
- data/VERSION +1 -1
- data/dialy.gemspec +1 -1
- data/lib/dialy/data.rb +5 -0
- data/lib/dialy/data/countries.rb +17 -22
- data/lib/dialy/formatter.rb +1 -1
- data/spec/dialy_spec.rb +1 -0
- metadata +3 -3
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/dialy.gemspec
CHANGED
data/lib/dialy/data.rb
CHANGED
@@ -17,4 +17,9 @@ module Dialy
|
|
17
17
|
|
18
18
|
AC_RANGE[country_code] = (min_length..max_length)
|
19
19
|
end
|
20
|
+
|
21
|
+
# same for country codes
|
22
|
+
min_length = Math.log10(COUNTRY_CODES.min).to_i + 1
|
23
|
+
max_length = Math.log10(COUNTRY_CODES.max).to_i + 1
|
24
|
+
CC_RANGE = (min_length..max_length)
|
20
25
|
end
|
data/lib/dialy/data/countries.rb
CHANGED
@@ -1,26 +1,21 @@
|
|
1
|
+
######################################################################################################################
|
2
|
+
#
|
3
|
+
# Country calling codes
|
4
|
+
# Taken from http://de.wikipedia.org/wiki/L%C3%A4ndervorwahlliste_sortiert_nach_Nummern
|
5
|
+
#
|
6
|
+
######################################################################################################################
|
7
|
+
|
1
8
|
module Dialy
|
2
9
|
COUNTRY_CODES = [
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
41,
|
14
|
-
43,
|
15
|
-
49,
|
16
|
-
|
17
|
-
# Zone 5
|
18
|
-
|
19
|
-
# Zone 6
|
20
|
-
|
21
|
-
# Zone 7
|
22
|
-
|
23
|
-
# Zone 8
|
24
|
-
800
|
10
|
+
1, 20, 212, 213, 216, 218, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
|
11
|
+
237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 260,
|
12
|
+
261, 262, 263, 264, 265, 266, 267, 268, 269, 27, 290, 291, 297, 298, 299, 30, 31, 32, 33, 34, 350, 351, 352, 353,
|
13
|
+
354, 355, 356, 357, 358, 359, 36, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 385, 386, 387,
|
14
|
+
388, 389, 39, 40, 41, 420, 421, 423, 43, 44, 45, 46, 47, 48, 49, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509,
|
15
|
+
51, 52, 53, 54, 55, 56, 57, 58, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 60, 61, 62, 63, 64, 649, 65, 66,
|
16
|
+
670, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 685, 686, 687, 688, 689, 690, 691, 692, 7, 800,
|
17
|
+
808, 81, 82, 84, 850, 852, 853, 855, 856, 86, 870, 875, 876, 877, 878, 879, 880, 881, 882, 883, 886, 90, 91, 92,
|
18
|
+
93, 94, 95, 960, 961, 962, 963, 964, 965, 966, 967, 968, 970, 971, 972, 973, 974, 975, 976, 977, 979, 98, 991, 992,
|
19
|
+
993, 994, 995, 996, 998, 999
|
25
20
|
].freeze
|
26
21
|
end
|
data/lib/dialy/formatter.rb
CHANGED
@@ -15,7 +15,7 @@ module Dialy
|
|
15
15
|
# Because the length of a country code is not fixed, we have to do
|
16
16
|
# multiple searches. Start with the minimum length and go to the
|
17
17
|
# maxium until an area code is found.
|
18
|
-
|
18
|
+
CC_RANGE.each do |len|
|
19
19
|
part = match[2][0,len].to_i
|
20
20
|
|
21
21
|
if COUNTRY_CODES.include?(part)
|
data/spec/dialy_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dialy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Georg Ledermann
|