dialy 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,6 @@ You can install the library as a gem
32
32
 
33
33
  == TODO
34
34
 
35
- * Add country codes from http://en.wikipedia.org/wiki/List_of_country_calling_codes
36
35
  * Add area codes for other countries than DE/AT/CH
37
36
 
38
37
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dialy}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Georg Ledermann"]
@@ -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
@@ -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
- # TODO: Add more from http://en.wikipedia.org/wiki/List_of_country_calling_codes
4
-
5
- # Zone 1
6
- 1,
7
-
8
- # Zone 2
9
-
10
- # Zone 3
11
-
12
- # Zone 4
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
@@ -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
- (1..3).each do |len|
18
+ CC_RANGE.each do |len|
19
19
  part = match[2][0,len].to_i
20
20
 
21
21
  if COUNTRY_CODES.include?(part)
@@ -17,6 +17,7 @@ describe "Dialy" do
17
17
  end
18
18
 
19
19
  it "should calc min and max length" do
20
+ Dialy::CC_RANGE.should == (1..3)
20
21
  Dialy::AC_RANGE[41].should == (2..3)
21
22
  Dialy::AC_RANGE[43].should == (1..4)
22
23
  Dialy::AC_RANGE[49].should == (2..5)
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Georg Ledermann