phony 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@ require File.expand_path '../phony/countries/italy', __FILE__
23
23
  require File.expand_path '../phony/countries/netherlands', __FILE__
24
24
  require File.expand_path '../phony/countries/peru', __FILE__
25
25
  require File.expand_path '../phony/countries/romania', __FILE__
26
+ require File.expand_path '../phony/countries/south_korea', __FILE__
26
27
  require File.expand_path '../phony/countries/sweden', __FILE__
27
28
 
28
29
  require File.expand_path '../phony/country_codes', __FILE__
@@ -101,7 +101,7 @@ module Phony
101
101
  :local_format => [7]
102
102
  ),
103
103
 
104
- '60' => fixed(2), # TODO Malaysia
104
+ '60' => fixed(2), # TODO Malaysia, http://en.wikipedia.org/wiki/Telephone_numbers_in_Malaysia
105
105
  '61' => fixed(1, # Australia
106
106
  :local_format => [4, 4]
107
107
  ),
@@ -114,7 +114,7 @@ module Phony
114
114
  '66' => fixed(2), # TODO Thailand
115
115
 
116
116
  '81' => fixed(2), # TODO Japan
117
- '82' => fixed(2), # TODO Korea (Republic of)
117
+ '82' => Countries::SouthKorea, # Korea (Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_South_Korea
118
118
  '84' => fixed(2), # TODO Viet Nam (Socialist Republic of)
119
119
  '86' => Countries::China, # China (People's Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_China
120
120
 
@@ -0,0 +1,15 @@
1
+ # South Korean (Republic of Korea) phone numbers.
2
+ #
3
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_South_Korea
4
+ #
5
+ Phony::Countries::SouthKorea = Phony::Country.configured :local_format => [4, 4],
6
+ :ndc_fallback_length => 2,
7
+ :ndc_mapping => {
8
+ :landline => [
9
+ '2', # Seoul
10
+ ],
11
+ :mobile => %w{ 10 11 12 13 14 15 16 17 18 19 },
12
+ # TODO 4-digit services, like "unreasonable infringement of livelihood report" number :)
13
+ #
14
+ :service => %w{ 30 50 60 70 80 100 101 105 106 107 108 109 111 112 113 114 115 116 117 118 119 120 121 122 123 125 127 128 129 131 132 134 141 182 188 }
15
+ }
@@ -69,6 +69,11 @@ describe Phony do
69
69
  it 'handles russian numbers' do
70
70
  Phony.split('78122345678').should == ['7', '812', '234', '56', '78']
71
71
  end
72
+ it 'handles south korean numbers' do
73
+ Phony.split('82212345678').should == ['82', '2', '1234', '5678'] # Seoul
74
+ Phony.split('825112345678').should == ['82', '51', '1234', '5678'] # Busan
75
+ Phony.split('821027975588').should == ['82', '10', '2797', '5588'] # mobile
76
+ end
72
77
  it "should handle swedish numbers" do
73
78
  Phony.split('46812345678').should == ['46', '8', '12345678']
74
79
  Phony.split('46111234567').should == ['46', '11', '1234567']
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 2
9
- version: 1.2.2
8
+ - 3
9
+ version: 1.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Florian Hanke
@@ -39,6 +39,7 @@ files:
39
39
  - lib/phony/countries/netherlands.rb
40
40
  - lib/phony/countries/peru.rb
41
41
  - lib/phony/countries/romania.rb
42
+ - lib/phony/countries/south_korea.rb
42
43
  - lib/phony/countries/sweden.rb
43
44
  - lib/phony/country.rb
44
45
  - lib/phony/country_codes.rb