Skip to content

Commit

Permalink
Adds Aregentina, Costa Rica, Ethiopia and Tonga
Browse files Browse the repository at this point in the history
  • Loading branch information
wmoxam committed Apr 15, 2012
1 parent 9b9f60c commit 53d7102
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Readme.rdoc
Expand Up @@ -89,14 +89,17 @@ You can add your own custom named formats like so:
Parse testing for different countries.

Currently tested on:
[AR] Argentina
[AU] Australia
[BA] Bosnia and Herzegovina
[BD] Bangladesh
[BE] Belgium
[BT] Bhutan
[CA] Canada
[CR] Costa Rica
[DE] Germany
[EG] Egypt
[ET] Ethiopia
[FR] France
[GB] United Kingdom
[GH] Ghana
Expand All @@ -117,6 +120,7 @@ Currently tested on:
[SA] Saudi Arabia
[SE] Sweden
[SI] Slovenia
[TO] Tonga
[UA] Ukraine
[US] United States
[ZA] South Africa
Expand Down
16 changes: 16 additions & 0 deletions data/phone_countries.yml
Expand Up @@ -6,27 +6,43 @@
:char_3_code: TO
:name: Tonga
:international_dialing_prefix: "0"
:area_code: "[2-8]\\d"
:local_number_format: "\\d{3}"
:mobile_format: "8[789]\\d{3}"
:number_format: "\\d{5}"
"54":
:country_code: "54"
:national_dialing_prefix: "0"
:char_2_code: "0"
:char_3_code: AR
:name: Argentina
:international_dialing_prefix: "0"
:area_code: "11|291|3833|297|345|351|3783|3717|3525|221|3822|223|261|2324|299|343|3752|3722|258|241|287|264|2652|2461|2627|342|285|2756|2293|2965|\\d{2,4}"
:local_number_format: "\\d{6,8}"
:mobile_format: "9\\d{10}"
:number_format: "[1-8]\\d{9}|9\\d{10}"
"506":
:country_code: "506"
:national_dialing_prefix: None
:char_2_code: None
:char_3_code: CR
:name: Costa Rica
:international_dialing_prefix: "0"
:area_code: "[28]"
:local_number_format: "\\d{7}"
:mobile_format: "8\\d{7}"
:number_format: "\\d{8}"
"251":
:country_code: "251"
:national_dialing_prefix: "0"
:char_2_code: "0"
:char_3_code: ET
:name: Ethiopia
:international_dialing_prefix: "0"
:area_code: "11|46|33|25|57|58|47|34|22|46|91"
:local_number_format: "\\d{7}"
:mobile_format: "91\\d{7}"
:number_format: "\\d{9}"
"590":
:country_code: "590"
:national_dialing_prefix: None
Expand Down
12 changes: 12 additions & 0 deletions test/countries/ar_test.rb
@@ -0,0 +1,12 @@
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

## Argentina
class ARTest < Phoner::TestCase
def test_local
parse_test('+541112345678', '54', '11', '12345678', 'Argentina', false)
end

def test_mobile
parse_test('+5498211534567', '54', '9821', '1534567', 'Argentina', true)
end
end
12 changes: 12 additions & 0 deletions test/countries/cr_test.rb
@@ -0,0 +1,12 @@
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

## Costa Rica
class CRTest < Phoner::TestCase
def test_local
parse_test('+50621234567', '506', '2', '1234567', 'Costa Rica', false)
end

def test_mobile
parse_test('50681234567', '506', '8', '1234567', 'Costa Rica', true)
end
end
11 changes: 11 additions & 0 deletions test/countries/et_test.rb
@@ -0,0 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class ETTest < Phoner::TestCase
def test_local
parse_test('251111234567', '251', '11', '1234567', 'Ethiopia', false)
end

def test_mobile
parse_test('+251911234567', '251', '91', '1234567', 'Ethiopia', true)
end
end
12 changes: 12 additions & 0 deletions test/countries/to_test.rb
@@ -0,0 +1,12 @@
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

## Tonga
class TOTest < Phoner::TestCase
def test_local
parse_test('+67679321', '676', '79', '321', "Tonga", false)
end

def test_mobile
parse_test('67688321', '676', '88', '321', "Tonga", true)
end
end

0 comments on commit 53d7102

Please sign in to comment.