[
  {
    "path": ".document",
    "content": "- \nChangeLog.md\nLICENSE.txt\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: Ruby CI\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\njobs:\n  test:\n\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        ruby-version: [\"3.4\", \"3.3\", \"3.2\", \"3.1\", \"3.0\", \"2.7\", \"jruby-head\", \"ruby-head\"]\n\n    steps:\n      - uses: actions/checkout@v4\n      - name: Set up Ruby ${{ matrix.ruby-version }}\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: ${{ matrix.ruby-version }}\n          bundler-cache: true # runs 'bundle install' and caches installed gems automatically\n      - name: Run tests\n        run: bundle exec rake\n"
  },
  {
    "path": ".gitignore",
    "content": "Gemfile.lock\ndoc/\npkg/\ntmp/\nvendor/cache/*.gem\n"
  },
  {
    "path": ".ruby-version",
    "content": "2.0.0\n"
  },
  {
    "path": ".yardopts",
    "content": "--markup markdown --title \"phone Documentation\" --protected\n"
  },
  {
    "path": "ChangeLog.md",
    "content": "# 1.3.0 / (unreleased)\n\n* Update README for yaml name and location (pepe)\n* Relocate / rename `data/phone_countries.yml` to `data/phone/countries.yml` (elskwid)\n* [improvement] Add modern gem infrastructure - add bundler, update gemspec, convert to minitest, locate gem files in proper directories, add .ruby-version, update README, update LICENSE.txt, add Changelog.md. (elskwid)\n* [improvement] Memoize country code regex. (tiegz)\n* [improvement] Update regex for: ZA, UY, NL, BE, FR, HU, PT, UA, RS, HR, SE, SI, and BA. (g1smd)\n* [improvement] Add IE support. (dramalho)\n* [improvement] Update #split_to_parts to provide a format override and handle nil parts. (dramalho)\n* [improvement] Add NZ support. (jurgens)\n* [improvement] Add options support to `#valid?`. (soulcutter)\n* [improvement] Remove need for `cattr_accessor`. (elskwid)\n* [fix] Incorrect error raised when missing phone number and add missing test. (elskwid)\n* [fix] Fix extension handling in `::parse`. (elskwid)\n* [improvement] Remove need for ActiveSupport detection. (elskwid)\n* [improvement] Remove monkeypatching support library. (elskwid)\n* [improvement] Add support for Travis CI. (elskwid)\n* [improvement] Add tests for parameter mutation in `#valid?`. (elskwid)\n* [fix] Fix parameter mutation in extension extraction. (elskwid)\n* [fix] ME (Montenegro) area code correction and tests. (bsboris)\n* [improvement] Add test for parameter mutation in `::parse`. (elskwid)\n* [improvement] Code style clean up and method refactoring to clarify processing and remove multiple gsub calls. (elskwid)\n* [doc] README updates.\n\n# 1.2.3 / 2013-11-16\n\n* [fix] Bring changes from v1.1 that were mysteriously missing from repo. (elskwid)\n  - README updates\n  - Spain area code updates\n  - Support 3 character codes for countries\n  - Update default area code\n  - Update `::normalize`\n\n# 1.2.2 / 2013-11-15\n\n* Add license to gemspec. (bf4)\n\n# 1.2.1 / 2013-10-24\n\n* Add errors.rb to gemspec to fix gem. (mtarnovan)\n\n#  1.2 / 2013-10-23 (yanked)\n\n* Released to capture updates made after version 1.1. (elskwid)\n* Add specific exception classes. (miloshadzic)\n\n# 1.1 / 2011-06-23\n\n* Implement `==`. (haxney and carr)\n* Update Uraguay area codes and tests. (tiegz)\n\n# 1.0 / 2011-04-04\n\n* Namespaced library as `Phoner::Phone` (carr)\n\n# Previous versions ...\n"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\ngemspec\n\ngroup :doc do\n  gem \"redcarpet\"\nend\n\ngroup :test do\n  gem \"rake\"\nend\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "Copyright (c) 2010-2013 Tomislav Car\nModifications copyright (c) 2010 Todd Eichel for Fooala, Inc.\nCopyright (c) 2013 Don Morrison\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "[gem]: https://rubygems.org/gems/phone\n[stable]: https://github.com/carr/phone/tree/v1.2.3\n[gem-beta]: https://rubygems.org/gems/phone/versions/1.3.0.beta1\n[beta]: https://github.com/carr/phone/tree/v1.3.0.beta1/\n[ci]: https://github.com/carr/phone/actions/workflows/ci.yml\n\n# phone\n\n[![Beta Gem Version](https://img.shields.io/badge/beta-v1.3.0.beta1-blue.svg)][gem-beta]\n[![Gem Version](https://img.shields.io/gem/v/phone.svg)][gem]\n[![Build Status](https://github.com/carr/phone/actions/workflows/ci.yml/badge.svg)][ci]\n\nParsing, validating and creating phone numbers\n\n* [Homepage](https://github.com/carr/phone#readme)\n* [Issues](https://github.com/carr/phone/issues)\n* [Documentation](http://rubydoc.info/gems/phone/frames)\n* [Email](mailto:don at elskwid.net)\n\n## Version\n\nThis documentation is for the unreleased development branch.\n\n* Current release: [1.3.0.beta1][beta]\n* Current stable: [1.2.3][stable]\n\n## Description\n\nRuby library for phone number parsing, validation, and formatting.\n\n## Features\n\n### Automatic country and area code detection\n\nPhone does its best to automatically detect the country and area code while parsing. To do this, phone uses data stored in `data/phone/countries.yml`.\n\nEach country code can have a regular expression named `area_code` that describes what the area code for that particular country looks like.\n\nIf an `area_code` regular expression isn't specified, a default value which is considered correct for the US will be used.\n\nIf your country has phone numbers longer that 8 digits - exluding country and area code - you can specify that within the country's configuration in `data/phone/countries.yml`\n\n### Validating\n\nValidating is very relaxed, basically it strips out everything that's not a number or '+' character:\n\n```ruby\nPhoner::Phone.valid? 'blabla 091/555-4488 blabla'\n```\n\n### Formatting\n\nFormating is done via the `#format` method. The method accepts a `Symbol` or a `String`.\n\nWhen given a string, it interpolates the string with the following fields:\n\n* %c - country_code (385)\n* %a - area_code (91)\n* %A - area_code with leading zero (091)\n* %n - number (5554488)\n* %f - first @@n1_length characters of number (configured through Phoner::Phone.n1_length), default is 3 (555)\n* %l - last characters of number (4488)\n* %x - the extension number\n\n```ruby\npn = Phoner::Phone.parse('+385915554488')\npn.to_s # => \"+385915554488\"\npn.format(\"%A/%f-%l\") # => \"091/555-4488\"\npn.format(\"+ %c (%a) %n\") # => \"+ 385 (91) 5554488\"\n```\n\nWhen given a symbol it is used as a lookup for the format in the <tt>Phoner::Phone.named_formats</tt> hash.\n\n```ruby\npn.format(:europe) # => \"+385 (0) 91 555 4488\"\npn.format(:us) # => \"(234) 123-4567\"\npn.format(:default_with_extension) # => \"+3851234567x143\"\n```\n\nYou can add your own custom named formats like so:\n\n```ruby\nPhoner::Phone.named_formats[:short] = '%A/%n1-%n2'\npn.format(:short) # => 091/555-4488\n```\n\n### Finding countries by their isocode\n\nIf you don't have the country code, but you know from other sources what country a phone is from, you can retrieve the country using the country isocode (such as 'de', 'es', 'us', ...). Remember to call `Phoner::Country.load` before using this lookup.\n\n```ruby\nif country = Phoner::Country.find_by_country_isocode(user_country_isocode)\n  phone_number = Phoner::Phone.parse(user_input, :country_code => country.country_code)\nend\n```\n\n## Examples\n\n```ruby\nrequire 'phone'\n```\n\n### Initializing\n\nInitialize a new phone object with the number, area code, country code and extension number:\n\n```ruby\nPhoner::Phone.new('5554488', '91', '385')\n```\n\n```ruby\nPhoner::Phone.new(:number => '5554488', :area_code => '91', :country_code => '385', :extension => '143')\n```\n\n### Parsing\n\nCreate a new phone object by parsing from a string. Phoner::Phone does it's best to detect the country and area codes:\n\n```ruby\nPhoner::Phone.parse '+385915554488'\nPhoner::Phone.parse '00385915554488'\n```\n\nIf the country or area code isn't given in the string, you must set it, otherwise it doesn't work:\n\n```ruby\nPhoner::Phone.parse '091/555-4488', :country_code => '385'\nPhoner::Phone.parse '(091) 555 4488', :country_code => '385'\n```\n\nIf you feel that it's tedious, set the default country code once:\n\n```ruby\nPhoner::Phone.default_country_code = '385'\nPhoner::Phone.parse '091/555-4488'\nPhoner::Phone.parse '(091) 555 4488'\n```\n\nSame goes for the area code:\n\n```ruby\nPhoner::Phone.parse '451-588', :country_code => '385', :area_code => '47'\n```\nor\n\n```ruby\nPhoner::Phone.default_country_code = '385'\nPhoner::Phone.default_area_code = '47'\n\nPhoner::Phone.parse '451-588'\n```\n\n## Adding and maintaining countries\n\nFrom time to time, the specifics about your countries information may change. You can add or update your countries configuration by editing `data/phone/countries.yml`\n\nThe following are the available attributes for configuration:\n\n* `country_code`: Required. A string representing your country's international dialling code. e.g. \"123\"\n* `national_dialing_prefix`: Required. A string representing your default dialling prefix for national calls. e.g. \"0\"\n* `char_3_code`: Required. A string representing a country's ISO code. e.g. \"US\"\n* `name`: Required. The name of the country. e.g. \"Denmark\"\n* `international_dialing_prefix`: Required. The dialling prefix a country typically uses when making international calls. e.g. \"0\"\n* `area_code`: Optional. A regular expression detailing valid area codes. Default: \"\\d{3}\" i.e. any 3 digits.\n* `max_num_length`: Optional. The maximum length of a phone number after country and area codes have been removed. Default: 8\n\n## Test Countries\n\n* [AU] Australia\n* [BA] Bosnia and Herzegovina\n* [BE] Belgium\n* [DE] Germany\n* [ES] Spain\n* [FR] France\n* [GB] United Kingdom\n* [HR] Croatia\n* [HU] Hungary\n* [IE] Ireland\n* [ME] Montenegro\n* [NL] Netherlands\n* [NZ] New Zealand\n* [PT] Portugal\n* [RS] Serbia\n* [SE] Sweden\n* [SI] Slovenia\n* [UA] Ukraine\n* [US] United States\n* [UY] Uruguay\n* [ZA] South Africa\n\n## Known issues\n\nThere's an issue with Germany and Spanish area codes.\n\n## Requirements\n\n\n## Install\n\n    $ gem install phone\n\nOr as a Rails plugin, in your Gemfile\n\n    gem 'phone'\n\nAnd then `bundle install` from your command line.\n\n## Copyright\n\nCopyright (c) 2010-2013 Tomislav Car, [Infinum](http://www.infinum.co)\nCopyright (c) 2013 Don Morrison\n\nSee [LICENSE.txt](LICENSE.txt) for details.\n\n## Contributors\n\nDon Morrison, Michael Squires, Todd Eichel (Fooala, Inc.), chipiga, Etienne Samson, Luke Randall, Jakob Hilden, Tieg Zaharia\n"
  },
  {
    "path": "Rakefile",
    "content": "# encoding: utf-8\n\nrequire \"rubygems\"\n\nbegin\n  require \"bundler\"\nrescue LoadError => e\n  warn e.message\n  warn \"Run `gem install bundler` to install Bundler.\"\n  exit -1\nend\n\nbegin\n  Bundler.setup(:development)\nrescue Bundler::BundlerError => e\n  warn e.message\n  warn \"Run `bundle install` to install missing gems.\"\n  exit e.status_code\nend\n\nrequire \"rake\"\n\nrequire \"rubygems/tasks\"\nGem::Tasks.new\n\nrequire \"rake/testtask\"\n\nRake::TestTask.new do |test|\n  test.libs << \"test\"\n  test.pattern = \"test/**/*_test.rb\"\n  test.verbose = true\nend\n\nrequire \"yard\"\nYARD::Rake::YardocTask.new\ntask :doc => :yard\n\ntask :default => :test\n"
  },
  {
    "path": "data/phone/countries.yml",
    "content": "--- \n\"676\": \n  :country_code: \"676\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TO\n  :name: Tonga\n  :international_dialing_prefix: \"0\"\n\"54\": \n  :country_code: \"54\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AR\n  :name: Argentina\n  :international_dialing_prefix: \"0\"\n\"506\": \n  :country_code: \"506\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CR\n  :name: Costa Rica\n  :international_dialing_prefix: \"0\"\n\"251\": \n  :country_code: \"251\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ET\n  :name: Ethiopia\n  :international_dialing_prefix: \"0\"\n\"590\": \n  :country_code: \"590\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GP\n  :name: Guadeloupe\n  :international_dialing_prefix: \"0\"\n\"82\": \n  :country_code: \"82\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: KR\n  :name: Korea, Republic of\n  :international_dialing_prefix: \"1\"\n\"223\": \n  :country_code: \"223\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ML\n  :name: Mali\n  :international_dialing_prefix: \"0\"\n\"420\": \n  :country_code: \"420\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CZ\n  :name: Czech Republic\n  :international_dialing_prefix: \"0\"\n\"252\": \n  :country_code: \"252\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SO\n  :name: Somalia\n  :international_dialing_prefix: \"0\"\n\"677\": \n  :country_code: \"677\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SB\n  :name: Solomon Islands\n  :international_dialing_prefix: \"0\"\n\"421\": \n  :country_code: \"421\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SK\n  :name: Slovakia\n  :international_dialing_prefix: \"0\"\n\"507\": \n  :country_code: \"507\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: PA\n  :name: Panama\n  :international_dialing_prefix: \"0\"\n\"591\": \n  :country_code: \"591\"\n  :national_dialing_prefix: \"10\"\n  :char_2_code: \"10\"\n  :char_3_code: BO\n  :name: Bolivia\n  :international_dialing_prefix: \"10\"\n\"224\": \n  :country_code: \"224\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GN\n  :name: Guinea\n  :international_dialing_prefix: \"0\"\n\"84\": \n  :country_code: \"84\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: VN\n  :name: Viet Nam\n  :international_dialing_prefix: \"0\"\n\"678\": \n  :country_code: \"678\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: VU\n  :name: Vanuatu\n  :international_dialing_prefix: \"0\"\n\"27\": \n  :country_code: \"27\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ZA\n  :name: South Africa\n  :international_dialing_prefix: \"0\"\n  :area_code: \"800|86[01]|[1-9]\\\\d\"\n  :max_num_length: 11\n\"508\":\n  :country_code: \"508\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PM\n  :name: Saint Pierre And Miquelon\n  :international_dialing_prefix: \"0\"\n\"55\": \n  :country_code: \"55\"\n  :national_dialing_prefix: \"14\"\n  :char_2_code: \"14\"\n  :char_3_code: BR\n  :name: Brazil\n  :international_dialing_prefix: \"14\"\n\"253\": \n  :country_code: \"253\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: DJ\n  :name: Djibouti\n  :international_dialing_prefix: \"0\"\n\"592\": \n  :country_code: \"592\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GY\n  :name: Guyana\n  :international_dialing_prefix: \"0\"\n\"225\": \n  :country_code: \"225\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: CI\n  :name: \"C\\xC3\\xB4te D'Ivoire\"\n  :international_dialing_prefix: \"0\"\n\"56\": \n  :country_code: \"56\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: CL\n  :name: Chile\n  :international_dialing_prefix: \"0\"\n\"679\": \n  :country_code: \"679\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: FJ\n  :name: Fiji\n  :international_dialing_prefix: \"0\"\n\"509\": \n  :country_code: \"509\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: HT\n  :name: Haiti\n  :international_dialing_prefix: \"0\"\n\"593\": \n  :country_code: \"593\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: EC\n  :name: Ecuador\n  :international_dialing_prefix: \"0\"\n\"254\": \n  :country_code: \"254\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: KE\n  :name: Kenya\n  :international_dialing_prefix: \"0\"\n\"226\": \n  :country_code: \"226\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: BF\n  :name: Burkina Faso\n  :international_dialing_prefix: \"0\"\n\"423\": \n  :country_code: \"423\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: LI\n  :name: Liechtenstein\n  :international_dialing_prefix: \"0\"\n\"255\": \n  :country_code: \"255\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: TZ\n  :name: Tanzania, United Republic of\n  :international_dialing_prefix: \"0\"\n\"227\": \n  :country_code: \"227\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: NE\n  :name: Niger\n  :international_dialing_prefix: \"0\"\n\"594\": \n  :country_code: \"594\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GF\n  :name: French Guiana\n  :international_dialing_prefix: \"0\"\n\"86\": \n  :country_code: \"86\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: CN\n  :name: China\n  :international_dialing_prefix: \"0\"\n\"960\": \n  :country_code: \"960\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: MV\n  :name: Maldives\n  :international_dialing_prefix: \"0\"\n\"57\": \n  :country_code: \"57\"\n  :national_dialing_prefix: \"5\"\n  :char_2_code: \"5\"\n  :char_3_code: CO\n  :name: Colombia\n  :international_dialing_prefix: \"5\"\n\"58\": \n  :country_code: \"58\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: VE\n  :name: Venezuela, Bolivarian Republic of\n  :international_dialing_prefix: \"0\"\n\"256\": \n  :country_code: \"256\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: UG\n  :name: Uganda\n  :international_dialing_prefix: \"0\"\n\"228\": \n  :country_code: \"228\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TG\n  :name: Togo\n  :international_dialing_prefix: \"0\"\n\"595\": \n  :country_code: \"595\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PY\n  :name: Paraguay\n  :international_dialing_prefix: \"2\"\n\"961\": \n  :country_code: \"961\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: LB\n  :name: Lebanon\n  :international_dialing_prefix: \"0\"\n\"596\": \n  :country_code: \"596\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: MQ\n  :name: Martinique\n  :international_dialing_prefix: \"0\"\n\"257\": \n  :country_code: \"257\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: BI\n  :name: Burundi\n  :international_dialing_prefix: \"0\"\n\"229\": \n  :country_code: \"229\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: BJ\n  :name: Benin\n  :international_dialing_prefix: \"0\"\n\"962\": \n  :country_code: \"962\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: JO\n  :name: Jordan\n  :international_dialing_prefix: \"0\"\n\"963\": \n  :country_code: \"963\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SY\n  :name: Syrian Arab Republic\n  :international_dialing_prefix: \"0\"\n\"597\": \n  :country_code: \"597\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SR\n  :name: Suriname\n  :international_dialing_prefix: \"0\"\n\"680\": \n  :country_code: \"680\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: PW\n  :name: Palau\n  :international_dialing_prefix: \"0\"\n\"258\": \n  :country_code: \"258\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MZ\n  :name: Mozambique\n  :international_dialing_prefix: \"0\"\n\"30\": \n  :country_code: \"30\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GR\n  :name: Greece\n  :international_dialing_prefix: \"0\"\n\"681\": \n  :country_code: \"681\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: WF\n  :name: Wallis and Futuna\n  :international_dialing_prefix: \"19\"\n\"598\": \n  :country_code: \"598\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: UY\n  :name: Uruguay\n  :international_dialing_prefix: \"0\"\n  :area_code: \"2|42|4364|43[34567]|4452|44[3457]|454[24]|4567?|4586|46[234]|4675|47[237]|4779|9[0-9]\"\n\"992\": \n  :country_code: \"992\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: TJ\n  :name: Tajikistan\n  :international_dialing_prefix: \"810\"\n\"31\": \n  :country_code: \"31\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: NL\n  :name: Netherlands\n  :international_dialing_prefix: \"0\"\n  :area_code: \"6760|66|6|800|878|8[4578]|90[069]|1[035]|2[0346]|3[03568]|4[0356]|5[0358]|7\\\\d|11[134578]|16[124-8]|17[24]|18[0-467]|22[2-46-9]|25[125]|29[479]|31[3-8]|32[01]|34[1-8]|41[12368]|47[58]|48[15-8]|49[23579]|5[129][1-9]|54[134-8]|56[126]|57[0-3578]\"\n\"850\": \n  :country_code: \"850\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: KP\n  :name: Korea, Democratic People's Republic Of\n  :international_dialing_prefix: \"0\"\n\"964\": \n  :country_code: \"964\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: IQ\n  :name: Iraq\n  :international_dialing_prefix: \"0\"\n\"370\": \n  :country_code: \"370\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: LT\n  :name: Lithuania\n  :international_dialing_prefix: \"0\"\n\"993\": \n  :country_code: \"993\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: TM\n  :name: Turkmenistan\n  :international_dialing_prefix: \"810\"\n\"599\": \n  :country_code: \"599\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AN\n  :name: Netherlands Antilles\n  :international_dialing_prefix: \"0\"\n\"32\": \n  :country_code: \"32\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: BE\n  :name: Belgium\n  :international_dialing_prefix: \"0\"\n  :area_code: \"800|90\\\\d|2|3|4|9|1[0-69]|5\\\\d|6[013-9]|7[0178]|8[1-9]\"\n\"965\": \n  :country_code: \"965\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: KW\n  :name: Kuwait\n  :international_dialing_prefix: \"0\"\n\"371\": \n  :country_code: \"371\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: LV\n  :name: Latvia\n  :international_dialing_prefix: \"0\"\n\"682\": \n  :country_code: \"682\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: CK\n  :name: Cook Islands\n  :international_dialing_prefix: \"0\"\n\"60\": \n  :country_code: \"60\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MY\n  :name: Malaysia\n  :international_dialing_prefix: \"0\"\n\"966\": \n  :country_code: \"966\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SA\n  :name: Saudi Arabia\n  :international_dialing_prefix: \"0\"\n\"683\": \n  :country_code: \"683\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: NU\n  :name: Niue\n  :international_dialing_prefix: \"0\"\n\"230\": \n  :country_code: \"230\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: MU\n  :name: Mauritius\n  :international_dialing_prefix: \"20\"\n\"994\": \n  :country_code: \"994\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: AZ\n  :name: Azerbaijan\n  :international_dialing_prefix: \"810\"\n\"852\": \n  :country_code: \"852\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: HK\n  :name: Hong Kong\n  :international_dialing_prefix: \"1\"\n\"372\": \n  :country_code: \"372\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: EE\n  :name: Estonia\n  :international_dialing_prefix: \"0\"\n\"61\": \n  :country_code: \"61\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AU\n  :name: Australia\n  :international_dialing_prefix: \"11\"\n  :area_code: \"[234578]\"\n\"880\": \n  :country_code: \"880\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: BD\n  :name: Bangladesh\n  :international_dialing_prefix: \"0\"\n\"967\": \n  :country_code: \"967\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: YE\n  :name: Yemen\n  :international_dialing_prefix: \"0\"\n\"90\": \n  :country_code: \"90\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: TR\n  :name: Turkey\n  :international_dialing_prefix: \"0\"\n\"373\": \n  :country_code: \"373\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MD\n  :name: Moldova, Republic of\n  :international_dialing_prefix: \"0\"\n\"33\": \n  :country_code: \"33\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: FR\n  :name: France\n  :international_dialing_prefix: \"0\"\n  :area_code: \"[1-9]\"\n\"995\": \n  :country_code: \"995\"\n  :national_dialing_prefix: 8*\n  :char_2_code: 8*\n  :char_3_code: GE\n  :name: Georgia\n  :international_dialing_prefix: \"810\"\n\"853\": \n  :country_code: \"853\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MO\n  :name: Macao\n  :international_dialing_prefix: \"0\"\n\"231\": \n  :country_code: \"231\"\n  :national_dialing_prefix: \"22\"\n  :char_2_code: \"22\"\n  :char_3_code: LR\n  :name: Liberia\n  :international_dialing_prefix: \"0\"\n\"62\": \n  :country_code: \"62\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ID\n  :name: Indonesia\n  :international_dialing_prefix: \"1\"\n\"260\": \n  :country_code: \"260\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ZM\n  :name: Zambia\n  :international_dialing_prefix: \"0\"\n\"34\": \n  :country_code: \"34\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: ES\n  :name: Spain\n  :international_dialing_prefix: \"0\"\n  :area_code: \"6[0-9][0-9]|7[1-9][0-9]|8[0-9][0-9]|9[0-9][0-9]\"  \n\"232\": \n  :country_code: \"232\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SL\n  :name: Sierra Leone\n  :international_dialing_prefix: \"0\"\n\"685\": \n  :country_code: \"685\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: WS\n  :name: Samoa\n  :international_dialing_prefix: \"0\"\n\"63\": \n  :country_code: \"63\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PH\n  :name: Philippines\n  :international_dialing_prefix: \"0\"\n\"968\": \n  :country_code: \"968\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: OM\n  :name: Oman\n  :international_dialing_prefix: \"0\"\n\"996\": \n  :country_code: \"996\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: KG\n  :name: Kyrgyzstan\n  :international_dialing_prefix: \"0\"\n\"374\": \n  :country_code: \"374\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: AM\n  :name: Armenia\n  :international_dialing_prefix: \"0\"\n\"91\": \n  :country_code: \"91\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: IN\n  :name: India\n  :international_dialing_prefix: \"0\"\n\"92\": \n  :country_code: \"92\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PK\n  :name: Pakistan\n  :international_dialing_prefix: \"0\"\n\"64\": \n  :country_code: \"64\"\n  :national_dialing_prefix: 0 (None fo\n  :char_2_code: 0 (None fo\n  :char_3_code: NZ\n  :name: New Zealand\n  :international_dialing_prefix: \"0\"\n  :area_code: \"[1-9]\"\n\"855\": \n  :country_code: \"855\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: KH\n  :name: Cambodia\n  :international_dialing_prefix: \"0\"\n\"261\": \n  :country_code: \"261\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: MG\n  :name: Madagascar\n  :international_dialing_prefix: \"0\"\n\"1\": \n  :country_code: \"1\"\n  :national_dialing_prefix: \"1\"\n  :char_2_code: \"1\"\n  :char_3_code: US\n  :name: United States\n  :international_dialing_prefix: \"11\"\n\"375\": \n  :country_code: \"375\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: BY\n  :name: Belarus\n  :international_dialing_prefix: \"810\"\n\"233\": \n  :country_code: \"233\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GH\n  :name: Ghana\n  :international_dialing_prefix: \"0\"\n\"686\": \n  :country_code: \"686\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: KI\n  :name: Kiribati\n  :international_dialing_prefix: \"0\"\n\"998\": \n  :country_code: \"998\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: UZ\n  :name: Uzbekistan\n  :international_dialing_prefix: \"810\"\n\"65\": \n  :country_code: \"65\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SG\n  :name: Singapore\n  :international_dialing_prefix: \"1\"\n\"290\": \n  :country_code: \"290\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SH\n  :name: Saint Helena\n  :international_dialing_prefix: \"0\"\n\"262\": \n  :country_code: \"262\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: RE\n  :name: \"R\\xC3\\xA9union\"\n  :international_dialing_prefix: \"0\"\n\"234\": \n  :country_code: \"234\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: NG\n  :name: Nigeria\n  :international_dialing_prefix: \"9\"\n\"687\": \n  :country_code: \"687\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: NC\n  :name: New Caledonia\n  :international_dialing_prefix: \"0\"\n\"856\": \n  :country_code: \"856\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: LA\n  :name: Lao People's Democratic Republic\n  :international_dialing_prefix: \"0\"\n\"93\": \n  :country_code: \"93\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AF\n  :name: Afghanistan\n  :international_dialing_prefix: \"0\"\n\"376\": \n  :country_code: \"376\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: AD\n  :name: Andorra\n  :international_dialing_prefix: \"0\"\n\"36\": \n  :country_code: \"36\"\n  :national_dialing_prefix: \"6\"\n  :char_2_code: \"6\"\n  :char_3_code: HU\n  :name: Hungary\n  :international_dialing_prefix: \"0\"\n  :area_code: \"1|[2-9]\\\\d\"\n\"263\": \n  :country_code: \"263\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ZW\n  :name: Zimbabwe\n  :international_dialing_prefix: \"0\"\n\"688\": \n  :country_code: \"688\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TV\n  :name: Tuvalu\n  :international_dialing_prefix: \"0\"\n\"94\": \n  :country_code: \"94\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: LK\n  :name: Sri Lanka\n  :international_dialing_prefix: \"0\"\n\"377\": \n  :country_code: \"377\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MC\n  :name: Monaco\n  :international_dialing_prefix: \"0\"\n\"235\": \n  :country_code: \"235\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TD\n  :name: Chad\n  :international_dialing_prefix: \"15\"\n\"291\": \n  :country_code: \"291\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ER\n  :name: Eritrea\n  :international_dialing_prefix: \"0\"\n\"66\": \n  :country_code: \"66\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: TH\n  :name: Thailand\n  :international_dialing_prefix: \"1\"\n\"886\": \n  :country_code: \"886\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TW\n  :name: Taiwan, Province Of China\n  :international_dialing_prefix: \"2\"\n\"378\": \n  :country_code: \"378\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SM\n  :name: San Marino\n  :international_dialing_prefix: \"0\"\n\"264\": \n  :country_code: \"264\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: NA\n  :name: Namibia\n  :international_dialing_prefix: \"0\"\n\"95\": \n  :country_code: \"95\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: MM\n  :name: Myanmar\n  :international_dialing_prefix: \"0\"\n\"236\": \n  :country_code: \"236\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CF\n  :name: Central African Republic\n  :international_dialing_prefix: \"0\"\n\"689\": \n  :country_code: \"689\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: PF\n  :name: French Polynesia\n  :international_dialing_prefix: \"0\"\n\"970\": \n  :country_code: \"970\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PS\n  :name: Palestinian Territory, Occupied\n  :international_dialing_prefix: \"0\"\n\"237\": \n  :country_code: \"237\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CM\n  :name: Cameroon\n  :international_dialing_prefix: \"0\"\n\"39\": \n  :country_code: \"39\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: IT\n  :name: Italy\n  :international_dialing_prefix: \"0\"\n\"265\": \n  :country_code: \"265\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: MW\n  :name: Malawi\n  :international_dialing_prefix: \"0\"\n\"971\": \n  :country_code: \"971\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AE\n  :name: United Arab Emirates\n  :international_dialing_prefix: \"0\"\n\"238\": \n  :country_code: \"238\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CV\n  :name: Cape Verde\n  :international_dialing_prefix: \"0\"\n\"266\": \n  :country_code: \"266\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: LS\n  :name: Lesotho\n  :international_dialing_prefix: \"0\"\n\"239\": \n  :country_code: \"239\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ST\n  :name: Sao Tome and Principe\n  :international_dialing_prefix: \"0\"\n\"7\": \n  :country_code: \"7\"\n  :national_dialing_prefix: \"8\"\n  :char_2_code: \"8\"\n  :char_3_code: RU\n  :name: Russian Federation\n  :international_dialing_prefix: \"810\"\n\"98\": \n  :country_code: \"98\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: IR\n  :name: Iran, Islamic Republic Of\n  :international_dialing_prefix: \"0\"\n\"972\": \n  :country_code: \"972\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: IL\n  :name: Israel\n  :international_dialing_prefix: \"0\"\n\"350\": \n  :country_code: \"350\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GI\n  :name: Gibraltar\n  :international_dialing_prefix: \"0\"\n\"267\": \n  :country_code: \"267\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: BW\n  :name: Botswana\n  :international_dialing_prefix: \"0\"\n\"690\": \n  :country_code: \"690\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TK\n  :name: Tokelau\n  :international_dialing_prefix: \"0\"\n\"268\": \n  :country_code: \"268\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SZ\n  :name: Swaziland\n  :international_dialing_prefix: \"0\"\n\"40\": \n  :country_code: \"40\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: RO\n  :name: Romania\n  :international_dialing_prefix: \"0\"\n\"351\": \n  :country_code: \"351\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: PT\n  :name: Portugal\n  :international_dialing_prefix: \"0\"\n  :area_code: \"2[12]|2[3-9][1-9]|70[78]|80[089]|9[136]|92[1-9]\"\n\"973\": \n  :country_code: \"973\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: BH\n  :name: Bahrain\n  :international_dialing_prefix: \"0\"\n\"380\": \n  :country_code: \"380\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: UA\n  :name: Ukraine\n  :international_dialing_prefix: \"00\"\n  :area_code: \"[1-9]\\\\d\"\n\"41\": \n  :country_code: \"41\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: CH\n  :name: Switzerland\n  :international_dialing_prefix: \"0\"\n\"974\": \n  :country_code: \"974\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: QA\n  :name: Qatar\n  :international_dialing_prefix: \"0\"\n\"691\": \n  :country_code: \"691\"\n  :national_dialing_prefix: \"1\"\n  :char_2_code: \"1\"\n  :char_3_code: FM\n  :name: Micronesia, Federated States Of\n  :international_dialing_prefix: \"11\"\n\"297\": \n  :country_code: \"297\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: AW\n  :name: Aruba\n  :international_dialing_prefix: \"0\"\n\"352\": \n  :country_code: \"352\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: LU\n  :name: Luxembourg\n  :international_dialing_prefix: \"0\"\n\"269\": \n  :country_code: \"269\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: YT\n  :name: Mayotte\n  :international_dialing_prefix: \"0\"\n\"381\": \n  :country_code: \"381\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: RS\n  :name: Serbia\n  :international_dialing_prefix: \"99\"\n  :area_code: \"[1-9]\\\\d\"\n\"975\": \n  :country_code: \"975\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: BT\n  :name: Bhutan\n  :international_dialing_prefix: \"0\"\n\"298\": \n  :country_code: \"298\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: FO\n  :name: Faroe Islands\n  :international_dialing_prefix: \"0\"\n\"353\": \n  :country_code: \"353\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: IE\n  :name: Ireland\n  :international_dialing_prefix: \"0\"\n  :area_code: \"1|[2,4-7,9][0-9]|8[0,3-9]|822|818\"  \n\"692\": \n  :country_code: \"692\"\n  :national_dialing_prefix: \"1\"\n  :char_2_code: \"1\"\n  :char_3_code: MH\n  :name: Marshall Islands\n  :international_dialing_prefix: \"0\"\n\"212\": \n  :country_code: \"212\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MA\n  :name: Morocco\n  :international_dialing_prefix: \"0\"\n\"382\": \n  :country_code: \"382\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: ME\n  :name: Montenegro\n  :international_dialing_prefix: \"99\"\n  :area_code: \"[2-6][0-9]\"\n\"976\": \n  :country_code: \"976\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MN\n  :name: Mongolia\n  :international_dialing_prefix: \"1\"\n\"240\": \n  :country_code: \"240\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GQ\n  :name: Equatorial Guinea\n  :international_dialing_prefix: \"0\"\n\"299\": \n  :country_code: \"299\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GL\n  :name: Greenland\n  :international_dialing_prefix: \"9\"\n\"354\": \n  :country_code: \"354\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: IS\n  :name: Iceland\n  :international_dialing_prefix: \"0\"\n\"43\": \n  :country_code: \"43\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AT\n  :name: Austria\n  :international_dialing_prefix: \"0\"\n\"977\": \n  :country_code: \"977\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: NP\n  :name: Nepal\n  :international_dialing_prefix: \"0\"\n\"241\": \n  :country_code: \"241\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GA\n  :name: Gabon\n  :international_dialing_prefix: \"0\"\n\"355\": \n  :country_code: \"355\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AL\n  :name: Albania\n  :international_dialing_prefix: \"0\"\n\"213\": \n  :country_code: \"213\"\n  :national_dialing_prefix: \"7\"\n  :char_2_code: \"7\"\n  :char_3_code: DZ\n  :name: Algeria\n  :international_dialing_prefix: \"0\"\n\"44\": \n  :country_code: \"44\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: GB\n  :name: United Kingdom\n  :international_dialing_prefix: \"0\"\n  :area_code: \"2[03489]|11[3-8]|1[2-69]1|1[2-9][0-9]{2}|70|7[0-9]{3}|[8|9][0-9]{2}|3[0-9]{2}\"\n\"242\": \n  :country_code: \"242\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CG\n  :name: Congo\n  :international_dialing_prefix: \"0\"\n\"356\": \n  :country_code: \"356\"\n  :national_dialing_prefix: \"21\"\n  :char_2_code: \"21\"\n  :char_3_code: MT\n  :name: Malta\n  :international_dialing_prefix: \"0\"\n\"357\": \n  :country_code: \"357\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CY\n  :name: Cyprus\n  :international_dialing_prefix: \"0\"\n\"45\": \n  :country_code: \"45\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: DK\n  :name: Denmark\n  :international_dialing_prefix: \"0\"\n\"385\": \n  :country_code: \"385\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: HR\n  :name: Croatia\n  :international_dialing_prefix: \"0\"\n  :area_code: \"1|[2-9]\\\\d\"\n\"243\": \n  :country_code: \"243\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: CD\n  :name: Congo, The Democratic Republic Of The\n  :international_dialing_prefix: \"0\"\n\"216\": \n  :country_code: \"216\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TN\n  :name: Tunisia\n  :international_dialing_prefix: \"0\"\n\"46\": \n  :country_code: \"46\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SE\n  :name: Sweden\n  :international_dialing_prefix: \"0\"\n  :area_code: \"900|1[013689]|2[0136]|3[1356]|4[0246]|54|6[03]|7[01236]|8|9[09]|1[2457]\\\\d|2[2457-9]\\\\d|3[0247-9]\\\\d|4[1357-9]\\\\d|5[0-35-9]\\\\d|6[124-9]\\\\d|74\\\\d|9[1-8]\\\\d\"\n\"386\": \n  :country_code: \"386\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SI\n  :name: Slovenia\n  :international_dialing_prefix: \"0\"\n  :area_code: \"3[01]|4[01]|51|7[01]|64|59|1|2|3|4|5|6|7\"\n\"358\": \n  :country_code: \"358\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: FI\n  :name: Finland\n  :international_dialing_prefix: \"0\"\n\"244\": \n  :country_code: \"244\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: AO\n  :name: Angola\n  :international_dialing_prefix: \"0\"\n\"47\": \n  :country_code: \"47\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: \"NO\"\n  :name: Norway\n  :international_dialing_prefix: \"0\"\n\"359\": \n  :country_code: \"359\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: BG\n  :name: Bulgaria\n  :international_dialing_prefix: \"0\"\n\"387\": \n  :country_code: \"387\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: BA\n  :name: Bosnia and Herzegovina\n  :international_dialing_prefix: \"0\"\n  :area_code: \"6|[0-57-9]\\\\d\"\n\"245\": \n  :country_code: \"245\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GW\n  :name: Guinea-Bissau\n  :international_dialing_prefix: \"0\"\n\"48\": \n  :country_code: \"48\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PL\n  :name: Poland\n  :international_dialing_prefix: \"0\"\n\"218\": \n  :country_code: \"218\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: LY\n  :name: Libyan Arab Jamahiriya\n  :international_dialing_prefix: \"0\"\n\"49\": \n  :country_code: \"49\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: DE\n  :name: Germany\n  :international_dialing_prefix: \"0\"\n  :area_code: \"[0-9]{3}\"\n\"389\": \n  :country_code: \"389\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MK\n  :name: Macedonia, the Former Yugoslav Republic Of\n  :international_dialing_prefix: \"0\"\n\"670\": \n  :country_code: \"670\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: TL\n  :name: Timor-Leste\n  :international_dialing_prefix: None\n\"248\": \n  :country_code: \"248\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SC\n  :name: Seychelles\n  :international_dialing_prefix: \"0\"\n\"20\": \n  :country_code: \"20\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: EG\n  :name: Egypt\n  :international_dialing_prefix: \"0\"\n\"500\": \n  :country_code: \"500\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: FK\n  :name: Falkland Islands (Malvinas)\n  :international_dialing_prefix: \"0\"\n\"249\": \n  :country_code: \"249\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: SD\n  :name: Sudan\n  :international_dialing_prefix: \"0\"\n\"501\": \n  :country_code: \"501\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: BZ\n  :name: Belize\n  :international_dialing_prefix: \"0\"\n\"672\": \n  :country_code: \"672\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: NF\n  :name: Norfolk Island\n  :international_dialing_prefix: \"0\"\n\"502\": \n  :country_code: \"502\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GT\n  :name: Guatemala\n  :international_dialing_prefix: \"0\"\n\"51\": \n  :country_code: \"51\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PE\n  :name: Peru\n  :international_dialing_prefix: \"0\"\n\"220\": \n  :country_code: \"220\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: GM\n  :name: Gambia\n  :international_dialing_prefix: \"0\"\n\"673\": \n  :country_code: \"673\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: BN\n  :name: Brunei Darussalam\n  :international_dialing_prefix: \"0\"\n\"503\": \n  :country_code: \"503\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SV\n  :name: El Salvador\n  :international_dialing_prefix: \"0\"\n\"221\": \n  :country_code: \"221\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: SN\n  :name: Senegal\n  :international_dialing_prefix: \"0\"\n\"674\": \n  :country_code: \"674\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: NR\n  :name: Nauru\n  :international_dialing_prefix: \"0\"\n\"52\": \n  :country_code: \"52\"\n  :national_dialing_prefix: \"1\"\n  :char_2_code: \"1\"\n  :char_3_code: MX\n  :name: Mexico\n  :international_dialing_prefix: \"0\"\n\"504\": \n  :country_code: \"504\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: HN\n  :name: Honduras\n  :international_dialing_prefix: \"0\"\n\"250\": \n  :country_code: \"250\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: RW\n  :name: Rwanda\n  :international_dialing_prefix: \"0\"\n\"872\": \n  :country_code: \"872\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: PN\n  :name: Pitcairn\n  :international_dialing_prefix: \"0\"\n\"675\": \n  :country_code: \"675\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: PG\n  :name: Papua New Guinea\n  :international_dialing_prefix: \"5\"\n\"505\": \n  :country_code: \"505\"\n  :national_dialing_prefix: None\n  :char_2_code: None\n  :char_3_code: NI\n  :name: Nicaragua\n  :international_dialing_prefix: \"0\"\n\"222\": \n  :country_code: \"222\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: MR\n  :name: Mauritania\n  :international_dialing_prefix: \"0\"\n\"53\": \n  :country_code: \"53\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: CU\n  :name: Cuba\n  :international_dialing_prefix: \"119\"\n\"81\": \n  :country_code: \"81\"\n  :national_dialing_prefix: \"0\"\n  :char_2_code: \"0\"\n  :char_3_code: JP\n  :name: Japan\n  :international_dialing_prefix: \"10\"\n"
  },
  {
    "path": "lib/phone/country.rb",
    "content": "require \"yaml\"\n\nmodule Phoner\n  class Country < Struct.new(:name, :country_code, :char_2_code, :char_3_code, :area_code, :max_num_length)\n    module All\n      attr_accessor :all\n    end\n    extend All\n\n    def all\n      self.class.all\n    end\n\n    def self.load\n      return self.all if !self.all.nil? && !self.all.empty?\n\n      data_file = File.join(\"..\",\"..\",\"data\", \"phone\", \"countries.yml\")\n      data_path = File.expand_path(data_file, File.dirname(__FILE__))\n\n      self.all = {}\n      YAML.load(File.read(data_path)).each_pair do |key, c|\n        self.all[key] = Country.new(\n          c[:name],\n          c[:country_code],\n          c[:char_2_code],\n          c[:char_3_code],\n          c.fetch(:area_code, \"[0-9][0-9][0-9]\").freeze,\n          c.fetch(:max_num_length, 8)\n        )\n      end\n\n      self.all\n    end\n\n    def self.find_by_country_code(code)\n      self.all[code]\n    end\n\n    def self.find_by_country_isocode(isocode)\n      if country = self.all.detect{|c|c[1].char_3_code.downcase == isocode}\n        country[1]\n      end\n    end\n\n    def to_s\n      name\n    end\n\n    def country_code_regexp\n      @country_code_regexp ||= Regexp.new(\"^[+]#{country_code}\")\n    end\n  end\nend\n"
  },
  {
    "path": "lib/phone/errors.rb",
    "content": "module Phoner\n  class PhoneError < RuntimeError;end\n  class BlankNumberError < PhoneError;end\n  class AreaCodeError < PhoneError;end\n  class CountryCodeError < PhoneError;end\nend\n"
  },
  {
    "path": "lib/phone/version.rb",
    "content": "module Phone\n  # phone version\n  VERSION = \"1.3.0.beta1\"\nend\n"
  },
  {
    "path": "lib/phone.rb",
    "content": "# An object representing a phone number.\n#\n# The phone number is recorded in 3 separate parts:\n# * country_code - e.g. \"385\", \"386\"\n# * area_code - e.g. \"91\", \"47\"\n# * number - e.g. \"5125486\", \"451588\"\n#\n# All parts are mandatory, but country code and area code can be set for all phone numbers using\n#   Phone.default_country_code\n#   Phone.default_area_code\n#\nrequire \"phone/country\"\nrequire \"phone/errors\"\n\nmodule Phoner\n  class Phone\n    module ClassAttributes\n      attr_accessor :default_country_code\n      attr_accessor :default_area_code\n      attr_accessor :named_formats\n      attr_accessor :n1_length\n    end\n    extend ClassAttributes\n\n    module ClassAttributeAccessors\n      def default_country_code\n        self.class.default_country_code\n      end\n\n      def default_area_code\n        self.class.default_area_code\n      end\n\n      def named_formats\n        self.class.named_formats\n      end\n\n      def n1_length\n        self.class.n1_length\n      end\n    end\n    include ClassAttributeAccessors\n\n    self.named_formats = {\n      :default => \"+%c%a%n\",\n      :default_with_extension => \"+%c%a%nx%x\",\n      :europe => \"+%c (0) %a %f %l\",\n      :us => \"(%a) %f-%l\"\n    }\n\n    # length of first number part (using multi number format)\n    # default length of first number part\n    self.n1_length = 3\n\n    # common extension patterns\n    COMMON_EXTENSIONS = /[ ]*(ext|ex|x|xt|#|:)+[^0-9]*\\(*([-0-9]{1,})\\)*#?$/i\n    # common extra characters and sequences we normalize out\n    COMMON_EXTRAS = /(\\(0\\)|[^0-9+]|^\\+?00?)/\n    # replacements for extra characters\n    COMMON_EXTRAS_REPLACEMENTS = {\n      \"00\" => \"+\",\n      \"+00\" => \"+\",\n      \"+0\" => \"+\"\n    }\n    # default replacement\n    COMMON_EXTRAS_REPLACEMENTS.default = \"\"\n\n    # tokens used in the formatting string: %c, %a, %A, etc\n    FORMAT_TOKENS = /(%[caAnflx])/\n\n    # is this string a valid phone number?\n    def self.valid?(string, options = {})\n      begin\n        !parse(string, options).nil?\n      # if we encountered exceptions (missing country code, missing area code etc)\n      rescue PhoneError\n        return false\n      end\n    end\n\n    # create a new phone number by parsing a string\n    # the format of the string is detect automatically (from FORMATS)\n    def self.parse(string, options={})\n      return if string.to_s.empty?\n\n      Country.load\n      string, extension = extract_extension(string)\n      string = normalize(string)\n\n      options[:country_code] ||= self.default_country_code\n      options[:area_code] ||= self.default_area_code\n\n      parts = split_to_parts(string, options)\n\n      pn = Phone.new(parts.merge(:extension => extension)) if parts\n      return pn\n    end\n\n    # Returns an array of the number with the extension removed, and the extension.\n    #\n    # Example:\n    #\n    #  number, ext = Phoner::Phone.extract_extension(\"+1 (123) 456-7890 x321\")\n    #  # []\n    def self.extract_extension(string)\n      return [nil, nil] if string.nil?\n\n      if subbed = string.sub(COMMON_EXTENSIONS, \"\")\n        [subbed, $2]\n      else\n        [string, nil]\n      end\n    end\n\n    # fix string so it's easier to parse, remove extra characters etc.\n    def self.normalize(string_with_number)\n      # TODO: When we drop 1.8.7 we can pass the hash in as an arg to #gsub\n      string_with_number.gsub(COMMON_EXTRAS) do |match|\n        COMMON_EXTRAS_REPLACEMENTS[match.to_s]\n      end\n    end\n\n    # split string into hash with keys :country_code, :area_code and :number\n    def self.split_to_parts(string, options = {})\n      country = detect_country(string)\n\n      if country\n        options[:country_code] = country.country_code\n        string = string.gsub(country.country_code_regexp, \"0\")\n      else\n        if options[:country_code]\n          country = Country.find_by_country_code options[:country_code]\n        end\n      end\n\n      if country.nil?\n        if options[:country_code].nil?\n          raise CountryCodeError, \"Must enter country code or set default country code\"\n        else\n          raise CountryCodeError, \"Could not find country with country code #{options[:country_code]}\"\n        end\n      end\n\n      format = detect_format(string, country)\n      return nil if format.nil?\n\n      # Override the format IF overriding options are not present\n      format = :short if options[:area_code].nil?\n\n      parts = string.match formats(country)[format]\n      return nil if parts.nil?\n\n      case format\n        when :short\n          {\n            :number => parts[2],\n            :area_code => parts[1],\n            :country_code => options[:country_code]\n          }\n        when :really_short\n          {\n            :number => parts[1],\n            :area_code => options[:area_code],\n            :country_code => options[:country_code]\n          }\n      end\n    end\n\n    # detect country from the string entered\n    def self.detect_country(string)\n      detected_country = nil\n      # find if the number has a country code\n      Country.all.each_pair do |country_code, country|\n        if string =~ country.country_code_regexp\n          detected_country = country\n        end\n      end\n      detected_country\n    end\n\n    # detect format (from FORMATS) of input string\n    def self.detect_format(string_with_number, country)\n      arr = []\n      formats(country).each_pair do |format, regexp|\n        arr << format if string_with_number =~ regexp\n      end\n\n      # raise \"Detected more than 1 format for #{string_with_number}\" if arr.size > 1\n      if arr.length > 1\n        # puts %Q{detect_format: more than one format found - #{arr.inspect}}\n        return :really_short\n      end\n      arr.first\n    end\n\n    def self.formats(country)\n      area_code_regexp = country.area_code\n      number_regex     = \"([0-9]{1,#{country.max_num_length}})$\".freeze\n\n      {\n        # 047451588, 013668734\n        :short => Regexp.new(\"^0?(#{area_code_regexp})#{number_regex}\"),\n        # 451588\n        :really_short => Regexp.new(\"^#{number_regex}\")\n      }\n    end\n\n    attr_accessor :country_code, :area_code, :number, :extension\n\n    # Initialize a new instance with a list or hash of phone number parts\n    #\n    # Example:\n    #  Phone.new(\"5125486\", \"91\", \"385\")\n    #\n    #  # or\n    #\n    #  Phone.new(\n    #    :number => \"5125486\",\n    #    :area_code => \"91\",\n    #    :country_code => \"385\",\n    #    :extension => \"143\"\n    #  )\n    def initialize(*args)\n      input = args.first.is_a?(Hash) ? args.first : args_to_hash(args)\n\n      # set defaults\n      input[:area_code] ||= self.default_area_code\n      input[:country_code] ||= self.default_country_code\n\n      @number = input[:number].to_s.strip\n      raise BlankNumberError, \"Must enter number\" if @number.empty?\n\n      @area_code = input[:area_code].to_s.strip\n      raise AreaCodeError,\n            \"Must enter area code or set default\" if @area_code.empty?\n\n      @country_code = input[:country_code].to_s.strip\n      raise CountryCodeError,\n            \"Must enter country code or set default\" if @country_code.empty?\n\n      @extension = input[:extension]\n    end\n\n    # format area_code with trailing zero (e.g. 91 as 091)\n    # format area_code with trailing zero (e.g. 91 as 091)\n    def area_code_long\n      \"0#{area_code}\" if area_code\n    end\n\n    # first n characters of :number\n    def number1\n      number[0...self.class.n1_length]\n    end\n\n    # everything left from number after the first n characters (see number1)\n    def number2\n      n2_length = number.size - self.class.n1_length\n      number[-n2_length, n2_length]\n    end\n\n    # Formats the phone number.\n    #\n    # if the method argument is a String, it is used as a format string, with the following fields being interpolated:\n    #\n    # * %c - country_code (385)\n    # * %a - area_code (91)\n    # * %A - area_code with leading zero (091)\n    # * %n - number (5125486)\n    # * %f - first @@n1_length characters of number (configured through Phone.n1_length), default is 3 (512)\n    # * %l - last characters of number (5486)\n    # * %x - entire extension\n    #\n    # if the method argument is a Symbol, it is used as a lookup key for a format String in Phone.named_formats\n    #   pn.format(:europe)\n    def format(fmt)\n      if fmt.is_a?(Symbol)\n        raise \"The format #{fmt} doesn't exist\" unless named_formats.has_key?(fmt)\n        format_number named_formats[fmt]\n      else\n        format_number(fmt)\n      end\n    end\n\n    # the default format is \"+%c%a%n\"\n    def to_s\n      format(:default)\n    end\n\n    # does this number belong to the default country code?\n    def has_default_country_code?\n      country_code == self.class.default_country_code\n    end\n\n    # does this number belong to the default area code?\n    def has_default_area_code?\n      area_code == self.class.default_area_code\n    end\n\n    # comparison of 2 phone objects\n    def ==(other)\n      methods = [:country_code, :area_code, :number, :extension]\n      methods.all? { |method| other.respond_to?(method) && send(method) == other.send(method) }\n    end\n\n    private\n\n    # Convert initialize arguments into parameter hash\n    #\n    # Example:\n    #\n    # args_to_hash [\"5125486\", \"91\", \"385\"]\n    # #=> { :number => \"5125486\",\n    #       :area_code => \"91\",\n    #       :country_code => \"385\",\n    #       :extension => nil }\n    def args_to_hash(args)\n      {\n        :number => args[0],\n        :area_code => args[1],\n        :country_code => args[2],\n        :extension => args[3]\n      }\n    end\n\n    def format_number(fmt)\n      replacements = {\n        \"%c\" => (country_code || \"\"),\n        \"%a\" => (area_code || \"\"),\n        \"%A\" => (area_code_long || \"\"),\n        \"%n\" => (number || \"\"),\n        \"%f\" => (number1 || \"\"),\n        \"%l\" => (number2 || \"\"),\n        \"%x\" => (extension || \"\")\n      }\n\n      # TODO: When we drop 1.8.7 we can pass the hash in as an arg to #gsub\n      fmt.gsub(FORMAT_TOKENS) do |match|\n        replacements[match.to_s]\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "phone.gemspec",
    "content": "# -*- encoding: utf-8 -*-\n\nrequire File.expand_path(\"../lib/phone/version\", __FILE__)\n\nGem::Specification.new do |gem|\n  gem.name          = \"phone\"\n  gem.version       = Phone::VERSION\n  gem.summary       = %q{Phone number parsing, validation and formatting}\n  gem.description   = %q{Phone number parsing, validation and formatting in Ruby}\n  gem.license       = \"MIT\"\n  gem.authors       = [\"Tomislav Carr\", \"Todd Eichel\", \"Don Morrison\"]\n  gem.email         = [\"tomislav@infinum.hr\", \"todd@toddeichel.com\", \"don@elskwid.net\"]\n  gem.homepage      = \"https://github.com/carr/phone#readme\"\n\n  gem.files         = `git ls-files`.split($/)\n  gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})\n  gem.require_paths = [\"lib\"]\n\n  gem.add_development_dependency \"bundler\", \">= 1.2\"\n  gem.add_development_dependency \"minitest\", \"~> 5.0\"\n  gem.add_development_dependency \"rake\", \"~> 10.0\"\n  gem.add_development_dependency \"rubygems-tasks\", \"~> 0.2\"\n  gem.add_development_dependency \"yard\", \"~> 0.8\"\nend\n"
  },
  {
    "path": "test/countries/au_test.rb",
    "content": "require \"helper\"\n\n# 0x 5551 reserved for fictitious use. (not including x=3)\n# 0x 7010 reserved for fictitious use.\n\n## Australia\nclass AUTest < Minitest::Test\n\n  # 00 Emergency and International access\n  # 01 Alternate phone services\n  # 014 Satellite phone services\n  # 016 Paging [+3D or +6D]\n  # 018 Analogue (AMPS) mobile phone - few numbers still in use [+6D]\n  # 0198 Data networks [+2D or +6D] - e.g. 0198 379 000 is the Dial-Up POP number for iiNet\n\n  # 02 Central East region (NSW, ACT)\n  def test_central_east\n    parse_test('+61 2 5551 1234', '61', '2', '55511234')\n  end\n\n  # 03 South-east region (VIC, TAS)\n  def test_south_east\n    parse_test('+61 3 5551 1234', '61', '3', '55511234')\n  end\n\n  # 04 Mobile services (Digital - GSM, CDMA, 3G)\n  def test_mobile\n    parse_test('+61 4 5551 1234', '61', '4', '55511234')\n  end\n\n  # 05 Universal/Personal numberings (uncommon)\n  def test_personal\n    parse_test('+61 5 5551 1234', '61', '5', '55511234')\n  end\n\n  # 07 North-east region (QLD)\n  def test_north_east\n    parse_test('+61 7 5551 1234', '61', '7', '55511234')\n  end\n\n  # 08 Central and West region (SA, NT, WA)\n  def test_central\n    parse_test('+61 8 5551 1234', '61', '8', '55511234')\n  end\n\n  # (Geographical region boundaries do not exactly follow state borders.)\n  # 1 Non-geographic numbers\n\nend\n"
  },
  {
    "path": "test/countries/ba_test.rb",
    "content": "require \"helper\"\n\n## Bosnia and Herzegovina\nclass BATest < Minitest::Test\n\n  def test_local\n    parse_test('+387 33 25 02 33', '387', '33', '250233')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/be_test.rb",
    "content": "# -*- coding: utf-8 -*-\nrequire \"helper\"\n\n## Belgium\nclass BETest < Minitest::Test\n\n  ## single digit\n  # 02:   Brussels (Bruxelles/Brussel)\n  def test_brussels\n    parse_test('+32 2 1234567', '32', '2', '1234567')\n  end\n  # 03:   Antwerpen (Antwerp), Sint-Niklaas\n  def test_antwerpen\n    parse_test('+32 3 1234567', '32', '3', '1234567')\n  end\n  # 04:   Liège (Luik), Voeren (Fourons)\n  def test_liege\n    parse_test('+32 4 1234567', '32', '4', '1234567')\n  end\n  # 09:   Gent (Ghent/Gand)\n  def test_gent\n    parse_test('+32 9 1234567', '32', '9', '1234567')\n  end\n\n  ## two digit\n  # 010:  Wavre (Waver)\n  def test_wavre\n    parse_test('+32 10 123456', '32', '10', '123456')\n  end\n  # 011:  Hasselt\n  def test_hasselt\n    parse_test('+32 11 123456', '32', '11', '123456')\n  end\n  # 012:  Tongeren (Tongres)\n  def test_tongeren\n    parse_test('+32 12 123456', '32', '12', '123456')\n  end\n  # 013:  Diest\n  def test_diest\n    parse_test('+32 13 123456', '32', '13', '123456')\n  end\n  # 014:  Herentals, Turnhout\n  # 015:  Mechelen (Malines)\n  # 016:  Leuven (Louvain), Tienen (Tirlemont)\n  # 019:  Waremme (Borgworm)\n  def test_waremme\n    parse_test('+32 19 123456', '32', '19', '123456')\n  end\n\n  # 050:  Brugge (Bruges), Zeebrugge\n  def test_brugge\n    parse_test('+32 50 123456', '32', '50', '123456')\n  end\n  # 051:  Roeselare (Roulers)\n  def test_roeselare\n    parse_test('+32 51 123456', '32', '51', '123456')\n  end\n  # 052:  Dendermonde (Termonde)\n  # 053:  Aalst (Alost)\n  # 054:  Ninove\n  # 055:  Ronse (Renaix)\n  # 056:  Kortrijk (Courtrai), Comines-Warneton, Mouscron (Moeskroen)\n  # 057:  Ieper (Ypres)\n  # 058:  Veurne (Furnes)\n  # 059:  Oostende (Ostend)\n  def test_oostende\n    parse_test('+32 59 123456', '32', '59', '123456')\n  end\n\n  # 060:  Chimay\n  def test_chimay\n    parse_test('+32 60 123456', '32', '60', '123456')\n  end\n  # 061:  Bastogne, Libramont-Chevigny\n  # 063:  Arlon (Aarlen)\n  # 064:  La Louviere\n  # 065:  Mons (Bergen)\n  # 067:  Nivelles (Nijvel)\n  def test_nivelles\n    parse_test('+32 67 123456', '32', '67', '123456')\n  end\n  # 068:  Ath (Aat)\n  # 069:  Tournai (Doornik)\n\n  # 070:  Specialty Numbers (i.e. bus information or bank information)\n  def test_specialty\n    parse_test('+32 70 123456', '32', '70', '123456')\n  end\n  # 071:  Charleroi\n\n  # 081:  Namur (Namen)\n  def test_namur\n    parse_test('+32 81 123456', '32', '81', '123456')\n  end\n  # 082:  Dinant\n  # 083:  Ciney\n  # 084:  Jemelle, Marche-en-Famenne\n  # 085:  Huy\n  # 086:  Durbuy\n  # 087:  Verviers\n  # 089:  Genk\n\n  # 0800: toll free service\n  def test_toll_free\n    parse_test('+32 800 12345', '32', '800', '12345')\n  end\n\n  # 090x: Premium numbers (0900, 0901, 0902, 0903, 0904, 0905, 0906, 0907, 0908, 0909)\n  def test_premium_900\n    parse_test('+32 900 12345', '32', '900', '12345')\n  end\n\n  def test_premium_901\n    parse_test('+32 901 12345', '32', '901', '12345')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/de_test.rb",
    "content": "require \"helper\"\n\n## Germany\nclass DETest < Minitest::Test\n\n  def test_local\n    parse_test('+49 714 1605832', '49', '714', '1605832')\n  end\n\n  def test_mobile\n    parse_test('+49 162 3499558', '49', '162', '3499558')\n  end\n\n  # TODO: germany has 2-5 length area codes, that's why this test doesn't go through\n  #def test_country_side\n  #  parse_test('+49 (0)6120 59511-23', '49', '6120', '5951123')\n  #end\n\nend\n"
  },
  {
    "path": "test/countries/es_test.rb",
    "content": "require \"helper\"\n\n## Spain\n# http://en.wikipedia.org/wiki/Telephone_numbers_in_Spain\n# http://gospain.about.com/od/practicaltraveltips/f/area_codes.htm\n\n# A problem is that landline area codes can be 2 (92) as well as 3 digits (923)\n# right now the area_code_regexp is only finding 3 digit area_codes\n\nclass ESTest < Minitest::Test\n  \n  def test_validates\n    Phoner::Phone.default_country_code = nil\n    assert_equal Phoner::Phone.valid?(\"+34-695-097-612\"), true\n    assert_equal Phoner::Phone.valid?(\"0034 91-3597426\"), true\n    assert_equal Phoner::Phone.valid?(\"+0034 91-3597426\"), true\n    assert_equal Phoner::Phone.valid?(\"+34 92-6563629\"), true\n    assert_equal Phoner::Phone.valid?(\"(+34) 606 275 213\"), true\n    assert_equal Phoner::Phone.valid?(\"+034 937 299 016\"), true\n    assert_equal Phoner::Phone.valid?(\"+34 93 487 32 93\"), true\n\n    Phoner::Phone.default_country_code = '34'\n    assert_equal Phoner::Phone.valid?(\" 607 65 05 01 \"), true\n    assert_equal Phoner::Phone.valid?(\" 971 15 66 33\"), true\n    assert_equal Phoner::Phone.valid?(\" 93-4559934\"), true\n    assert_equal Phoner::Phone.valid?(\"628 274 908\"), true\n    assert_equal Phoner::Phone.valid?(\"744 486 62 78\"), true\n    assert_equal Phoner::Phone.valid?(\"916754559\"), true\n    assert_equal Phoner::Phone.valid?(\"93.4327119\"), true\n    assert_equal Phoner::Phone.valid?(\"986300257\"), true\n  end\n  \nend\n"
  },
  {
    "path": "test/countries/fr_test.rb",
    "content": "require \"helper\"\n\n## France\nclass FRTest < Minitest::Test\n\n  def test_local\n    parse_test('+33 4 75 06 07 07', '33', '4', '75060707')\n  end\n\n  def test_mobile\n    parse_test('+33 6 11 22 33 44', '33', '6', '11223344')\n  end\n\n  def test_mobile_07\n     parse_test('+33 7 11 22 33 44', '33', '7', '11223344')\n  end\n\n  def test_voip\n    parse_test('+33 9 11 22 33 44', '33', '9', '11223344')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/gb_test.rb",
    "content": "# -*- coding: utf-8 -*-\nrequire \"helper\"\n\n# http://stakeholders.ofcom.org.uk/telecoms/numbering/guidance-tele-no/numbers-for-drama\n#\n# Geographic Area     Geographic Area Code  Telephone Number Range\n# (1000 numbers in each range)\n# Leeds               0113                  496 0000 to 496 0999\n# Sheffield           0114                  496 0000 to 496 0999\n# Nottingham          0115                  496 0000 to 496 0999\n# Leicester           0116                  496 0000 to 496 0999\n# Bristol             0117                  496 0000 to 496 0999\n# Reading             0118                  496 0000 to 496 0999\n# Birmingham          0121                  496 0000 to 496 0999\n# Edinburgh           0131                  496 0000 to 496 0999\n# Glasgow             0141                  496 0000 to 496 0999\n# Liverpool           0151                  496 0000 to 496 0999\n# Manchester          0161                  496 0000 to 496 0999\n# London              020                   7946 0000 to 7946 0999\n# Tyneside/Durham\n#/Sunderland          0191                  498 0000 to 498 0999\n# Northern Ireland    028                   9018 0000 to 9018 0999\n# Cardiff             029                   2018 0000 to 2018 0999\n# No area             01632                 960000 to 960999\n#\n# Other Telephone Numbers\n#\n# Telephone Number Type   Telephone Number Range\n# (1000 numbers in each range)\n# Mobile                  07700 900000 to 900999\n# Freephone               08081 570000 to 570999\n# Premium Rate Services   0909 8790000 to 8790999\n# UK Wide                 03069 990000 to 990999\n\nclass GBTest < Minitest::Test\n\n  ## SHORT CODES\n  # London              020                   7946 0000 to 7946 0999\n  def test_london\n    parse_test('+44 20 7946 0123', '44', '20', '79460123')\n  end\n\n  # Northern Ireland    028                   9018 0000 to 9018 0999\n  def test_northern_ireland\n    parse_test('+44 28 9018 0123', '44', '28', '90180123')\n  end\n\n  # Cardiff             029                   2018 0000 to 2018 0999\n  def test_cardiff\n    parse_test('+44 29 2018 0123', '44', '29', '20180123')\n  end\n\n  # Leeds               0113                  496 0000 to 496 0999\n  def test_leeds\n    parse_test('+44 113 496 0123', '44', '113', '4960123')\n  end\n\n  # Sheffield           0114                  496 0000 to 496 0999\n  def test_sheffield\n    parse_test('+44 114 496 0123', '44', '114', '4960123')\n  end\n\n  # Nottingham          0115                  496 0000 to 496 0999\n  def test_nottingham\n    parse_test('+44 115 496 0123', '44', '115', '4960123')\n  end\n\n  # Leicester           0116                  496 0000 to 496 0999\n  def test_leicester\n    parse_test('+44 116 496 0123', '44', '116', '4960123')\n  end\n\n  # Bristol             0117                  496 0000 to 496 0999\n  def test_bristol\n    parse_test('+44 117 496 0123', '44', '117', '4960123')\n  end\n\n  # Reading             0118                  496 0000 to 496 0999\n  def test_reading\n    parse_test('+44 118 496 0123', '44', '118', '4960123')\n  end\n\n  # Birmingham          0121                  496 0000 to 496 0999\n  def test_birmingham\n    parse_test('+44 121 496 0123', '44', '121', '4960123')\n  end\n\n  # Edinburgh           0131                  496 0000 to 496 0999\n  def test_edinburgh\n    parse_test('+44 131 496 0123', '44', '131', '4960123')\n  end\n\n  # Glasgow             0141                  496 0000 to 496 0999\n  def test_glasgow\n    parse_test('+44 141 496 0123', '44', '141', '4960123')\n  end\n\n  # Liverpool           0151                  496 0000 to 496 0999\n  def test_liverpool\n    parse_test('+44 151 496 0123', '44', '151', '4960123')\n  end\n\n  # Manchester          0161                  496 0000 to 496 0999\n  def test_manchester\n    parse_test('+44 161 496 0123', '44', '161', '4960123')\n  end\n\n  # Tyneside/Durham\n  #/Sunderland          0191                  498 0000 to 498 0999\n  def test_tyneside\n    parse_test('+44 191 496 0123', '44', '191', '4960123')\n  end\n\n  ## LONG CODES\n\n  # 01202 — Bournemouth (BO)\n  def test_bournemouth\n    parse_test('+44 1202 96 0123', '44', '1202', '960123')\n  end\n\n  # 01326 — Falmouth (FA)\n  def test_falmouth\n    parse_test('+44 1326 96 0123', '44', '1326', '960123')\n  end\n\n  # 01420 — Alton (HA)\n  def test_alton\n    parse_test('+44 1420 96 0123', '44', '1420', '960123')\n  end\n\n  # 01598 — Lynton (LY)\n  def test_lynton\n    parse_test('+44 1598 96 0123', '44', '1598', '960123')\n  end\n\n  # 01637 — Newquay (NE)\n  def test_newquay\n    parse_test('+44 1637 96 0123', '44', '1637', '960123')\n  end\n\n  # 01700 — Rothesay (RO)\n  def test_rothesay\n    parse_test('+44 1700 96 0123', '44', '1700', '960123')\n  end\n\n  # 01951 — Colonsay\n  def test_colonsay\n    parse_test('+44 1951 96 0123', '44', '1951', '960123')\n  end\n\n  # No area             01632                 960000 to 960999\n  def test_no_area\n    parse_test('+44 1632 96 0123', '44', '1632', '960123')\n  end\n\n  # Personal numbering  070 xxxx xxxx\n  def test_personal_numbering\n    parse_test('+44 70 00001234', '44', '70', '00001234')\n  end\n\n  # Mobile                  07700 900000 to 900999\n  def test_mobile\n    parse_test('+44 7700 900345', '44', '7700', '900345')\n  end\n\n  def test_mobile_2\n    parse_test('+44 7778 900345', '44', '7778', '900345')\n  end\n\n  # Freephone               08081 570000 to 570999\n  def test_freephone\n    parse_test('+44 808 1570123', '44', '808', '1570123')\n  end\n\n  def test_freephone_2\n    parse_test('+44 873 1570123', '44', '873', '1570123')\n  end\n\n  # Premium Rate Services   0909 8790000 to 8790999\n  def test_premium\n    parse_test('+44 909 8790999', '44', '909', '8790999')\n  end\n\n  def test_premium2\n    parse_test('+44 910 8790123', '44', '910', '8790123')\n  end\n\n  # UK Wide                 03069 990000 to 990999\n  def test_wide\n    parse_test('+44 306 9990123', '44', '306', '9990123')\n  end\n\n  def test_wide_2\n    parse_test('+44 339 9990123', '44', '339', '9990123')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/hr_test.rb",
    "content": "require \"helper\"\n\n## Croatia\nclass HRTest < Minitest::Test\n\n  def test_zagreb\n    parse_test('+38513668734', '385', '1', '3668734')\n  end\n\n  def test_mobile\n    parse_test('+385915125486', '385', '91', '5125486')\n  end\n\n  def test_long_without_special_characters\n    parse_test('+385915125486', '385', '91', '5125486')\n  end\n\n  def test_long_with_special_characters\n    parse_test('+ 385 (91) 512 / 5486 ', '385', '91', '5125486')\n  end\n\n  def test_long_with_leading_zeros\n    parse_test('00385915125486', '385', '91', '5125486')\n  end\n\n  def test_zagreb_long_with_leading_zeros\n    parse_test('0038513668734', '385', '1', '3668734')\n  end\n\n  def test_short_without_special_characters_with_country\n    Phoner::Phone.default_country_code = '385'\n    parse_test('044885047', '385', '44', '885047')\n  end\n\n  def test_zagreb_short_without_special_characters_with_country\n    Phoner::Phone.default_country_code = '385'\n    parse_test('013668734', '385', '1', '3668734')\n  end\n\n  def test_long_with_zero_in_brackets\n    Phoner::Phone.default_country_code = nil\n    parse_test('+385 (0)1 366 8111', '385', '1', '3668111')\n  end\n\n  def test_has_default_country_code\n    Phoner::Phone.default_country_code = '385'\n\n    assert_equal Phoner::Phone.parse('+38547451588').has_default_country_code?, true\n    assert_equal Phoner::Phone.parse('+38647451588').has_default_country_code?, false\n  end\n\n  def test_has_default_area_code\n    Phoner::Phone.default_country_code = '385'\n    Phoner::Phone.default_area_code = '47'\n\n    assert_equal Phoner::Phone.parse('047/451-588').has_default_area_code?, true\n    assert_equal Phoner::Phone.parse('032/336-1456').has_default_area_code?, false\n  end\n\n  def test_validates\n    Phoner::Phone.default_country_code = nil\n    assert_equal Phoner::Phone.valid?('00385915125486'), true\n    assert_equal Phoner::Phone.valid?('+385915125486'), true\n    assert_equal Phoner::Phone.valid?('+385 (91) 512 5486'), true\n    assert_equal Phoner::Phone.valid?('+38547451588'), true\n\n    Phoner::Phone.default_country_code = '385'\n    assert_equal Phoner::Phone.valid?('0915125486'), true\n    assert_equal Phoner::Phone.valid?('091/512-5486'), true\n    assert_equal Phoner::Phone.valid?('091/512-5486'), true\n    assert_equal Phoner::Phone.valid?('091 512 54 86'), true\n    assert_equal Phoner::Phone.valid?('091-512-54-86'), true\n    assert_equal Phoner::Phone.valid?('047/451-588'), true\n  end\n\nend\n"
  },
  {
    "path": "test/countries/hu_test.rb",
    "content": "require \"helper\"\n\n## Hungary\nclass HUTest < Minitest::Test\n\n  def test_mobile\n    parse_test('+36 30 5517999', '36', '30', '5517999')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/ie_test.rb",
    "content": "require \"helper\"\n\n## Ireland\nclass IETest < Minitest::Test\n\n  def test_short_cork_number\n    parse_test('+353 28 28946', '353', '28', '28946')\n  end\n\n  def test_short_cork_number_2\n    parse_test('+353 28 28943', '353', '28', '28943')\n  end\n\n  def test_short_wrong_area_code\n    pp = Phoner::Phone.parse('+353 33023')\n\n    assert_nil pp\n  end\n\nend\n"
  },
  {
    "path": "test/countries/me_test.rb",
    "content": "require \"helper\"\n\n## Montenegro\nclass METest < Minitest::Test\n\n  def test_mobile\n    parse_test('+382 69 555 5555', '382', '69', '5555555')\n  end\n\n  def test_local\n    parse_test('+382 20 555 5555', '382', '20', '5555555')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/nl_test.rb",
    "content": "require \"helper\"\n\n## Netherlands\nclass NETest < Minitest::Test\n\n  # 06:   mobile phone number\n  def test_mobile\n    parse_test('+31 6 12345678', '31', '6', '12345678')\n  end\n\n  # 066:  mobile pagers\n  def test_pagers\n    parse_test('+31 66 1234567', '31', '66', '1234567')\n  end\n\n  # 06760:  internet access number\n  def test_internet_access\n    parse_test('+31 6760 12345', '31', '6760', '12345')\n  end\n\n  # 0800: toll free number\n  def test_toll_free\n    parse_test('+31 800 123456', '31', '800', '123456')\n  end\n\n  # 084:  location independent (used mostly for fax-to-email and voicemail services)\n  def test_location_independent_84\n    parse_test('+31 84 1234567', '31', '84', '1234567')\n  end\n\n  # 085:  location independent\n  def test_location_independent_85\n    parse_test('+31 85 1234567', '31', '85', '1234567')\n  end\n\n  # 087:  location independent\n  def test_location_independent_87\n    parse_test('+31 87 1234567', '31', '87', '1234567')\n  end\n\n  # 088:  location independent (for companies)\n  def test_location_independent_88\n    parse_test('+31 88 1234567', '31', '88', '1234567')\n  end\n\n  # 0878: location independent (voice over IP)\n  def test_location_independent_878\n    parse_test('+31 878 123456', '31', '878', '123456')\n  end\n\n  # 0900: premium rate, information\n  def test_premium_900\n    parse_test('+31 900 123456', '31', '900', '123456')\n  end\n\n  # 0906: premium rate, erotic\n  def test_premium_906\n    parse_test('+31 906 123456', '31', '906', '123456')\n  end\n  # 0909: premium rate, entertainment\n\n  # 112:  emergency services number\n  # 14xxx(x): public authorities, where xxxx is the three- or four-digit area-code of the municipality\n  # 18xx: number information\n\n  # 01x(x) to 05x(x): geographical area codes\n\n  ## two digit\n  # 010 Rotterdam\n  def test_rotterdam\n    parse_test('+31 10 1234567', '31', '10', '1234567')\n  end\n  # 013 Tilburg\n  def test_tilburg\n    parse_test('+31 13 1234567', '31', '13', '1234567')\n  end\n  # 015 Delft\n\n  # 020 Amsterdam\n  def test_amsterdam\n    parse_test('+31 20 1234567', '31', '20', '1234567')\n  end\n  # 023 Haarlem\n  # 024 Nijmegen\n  # 026 Arnhem\n\n  # 030 Utrecht\n  def test_utrecht\n    parse_test('+31 30 1234567', '31', '30', '1234567')\n  end\n  # 033 Amersfoort\n  def test_amersfoort\n    parse_test('+31 33 1234567', '31', '33', '1234567')\n  end\n  # 035 Hilversum\n  # 036 Almere\n  # 038 Zwolle\n\n  # 040 Eindhoven\n  # 043 Maastricht\n  # 045 Heerlen\n  def test_heerlen\n    parse_test('+31 45 1234567', '31', '45', '1234567')\n  end\n  # 046 Sittard\n\n  # 050 Groningen\n  def test_groningen\n    parse_test('+31 50 1234567', '31', '50', '1234567')\n  end\n  # 053 Enschede\n  # 055 Apeldoorn\n  # 058 Leeuwarden\n  def test_leeuwarden\n    parse_test('+31 58 1234567', '31', '58', '1234567')\n  end\n\n  # 07x: geographical area codes (cities all over the country)\n  # 070 The Hague\n  def test_the_hague\n    parse_test('+31 70 1234567', '31', '70', '1234567')\n  end\n  # 071 Leiden\n  def test_leiden\n    parse_test('+31 71 1234567', '31', '71', '1234567')\n  end\n  # 072 Alkmaar\n  # 073 's-Hertogenbosch\n  # 074 Hengelo\n  # 075 Zaandam\n  def test_zaandam\n    parse_test('+31 75 1234567', '31', '75', '1234567')\n  end\n  # 076 Breda\n  # 077 Venlo\n  # 078 Dordrecht\n  # 079 Zoetermeer\n  def test_zoetermeer\n    parse_test('+31 79 1234567', '31', '79', '1234567')\n  end\n\n\n  ## three digit\n  # 0111 Zierikzee\n  def test_zierikzee\n    parse_test('+31 111 123456', '31', '111', '123456')\n  end\n  # 0113 Goes\n  def test_goes\n    parse_test('+31 113 123456', '31', '113', '123456')\n  end\n  # 0114 Hulst\n  # 0115 Terneuzen\n  # 0117 Sluis\n  def test_sluis\n    parse_test('+31 117 123456', '31', '117', '123456')\n  end\n  # 0118 Middelburg\n\n  # 0161 Gilze-Rijen\n  def test_gilze\n    parse_test('+31 161 123456', '31', '161', '123456')\n  end\n  # 0162 Oosterhout\n  # 0164 Bergen op Zoom\n  def test_bergen\n    parse_test('+31 164 123456', '31', '164', '123456')\n  end\n  # 0165 Roosendaal\n  # 0166 Tholen\n  # 0167 Steenbergen\n  # 0168 Zevenbergen\n\n  # 0172 Alphen aan den Rijn\n  def test_alphen\n    parse_test('+31 172 123456', '31', '172', '123456')\n  end\n  # 0174 Naaldwijk\n\n  # 0180 Ridderkerk\n  def test_ridderkerk\n    parse_test('+31 180 123456', '31', '180', '123456')\n  end\n  # 0181 Spijkenisse\n  # 0182 Gouda\n  def test_gouda\n    parse_test('+31 182 123456', '31', '182', '123456')\n  end\n  # 0183 Gorinchem\n  # 0184 Sliedrecht\n  # 0186 Oud-Beijerland\n  # 0187 Middelharnis\n\n  # 0222 Texel\n  def test_texel\n    parse_test('+31 222 123456', '31', '222', '123456')\n  end\n  # 0223 Den Helder\n  # 0224 Schagen\n  def test_shagen\n    parse_test('+31 224 123456', '31', '224', '123456')\n  end\n  # 0226 Harenkarspel\n  # 0227 Medemblik, Middenmeer as well as Heerhugowaard\n  # 0228 Enkhuizen\n  # 0229 Hoorn\n  def test_hoorn\n    parse_test('+31 229 123456', '31', '229', '123456')\n  end\n\n  # 0251 Beverwijk\n  def test_beverwijk\n    parse_test('+31 251 123456', '31', '251', '123456')\n  end\n  # 0252 Hillegom\n  # 0255 IJmuiden\n\n  # 0294 Weesp\n  def test_weesp\n    parse_test('+31 294 123456', '31', '294', '123456')\n  end\n  # 0297 Aalsmeer\n  # 0299 Purmerend\n\n  # 0313 Dieren\n  def test_dieren\n    parse_test('+31 313 123456', '31', '313', '123456')\n  end\n  # 0314 Doetinchem\n  # 0315 Terborg\n  def test_terborg\n    parse_test('+31 315 123456', '31', '315', '123456')\n  end\n  # 0316 Zevenaar\n  # 0317 Wageningen\n  # 0318 Ede / Veenendaal\n\n  # 0320 Lelystad\n  def test_lelystad\n    parse_test('+31 320 123456', '31', '320', '123456')\n  end\n  # 0321 Dronten\n\n  # 0341 Harderwijk\n  def test_harderwijk\n    parse_test('+31 341 123456', '31', '341', '123456')\n  end\n  # 0342 Barneveld\n  # 0343 Doorn\n  # 0344 Tiel\n  def test_tiel\n    parse_test('+31 344 123456', '31', '344', '123456')\n  end\n  # 0345 Culemborg\n  # 0346 Maarssen\n  # 0347 Vianen\n  # 0348 Woerden\n\n  # 0411 Boxtel\n  def test_boxtel\n    parse_test('+31 411 123456', '31', '411', '123456')\n  end\n  # 0412 Oss\n  # 0413 Veghel\n  # 0416 Waalwijk\n  # 0418 Zaltbommel\n\n  # 0475 Roermond\n  def test_roermond\n    parse_test('+31 475 123456', '31', '475', '123456')\n  end\n  # 0478 Venray\n\n  # 0481 Bemmel\n  def test_bemmel\n    parse_test('+31 481 123456', '31', '481', '123456')\n  end\n  # 0485 Cuijk\n  # 0486 Grave\n  # 0487 Druten\n  def test_druten\n    parse_test('+31 487 123456', '31', '487', '123456')\n  end\n  # 0488 Zetten\n\n  # 0492 Helmond\n  def test_helmond\n    parse_test('+31 492 123456', '31', '492', '123456')\n  end\n  # 0493 Deurne\n  # 0495 Weert\n  def test_weert\n    parse_test('+31 495 123456', '31', '495', '123456')\n  end\n  # 0497 Eersel\n  # 0499 Best\n\n  # 0511 Veenwouden\n  def test_veenwouden\n    parse_test('+31 511 123456', '31', '511', '123456')\n  end\n  # 0512 Drachten\n  # 0513 Heerenveen\n  # 0514 Balk\n  # 0515 Sneek\n  def test_sneek\n    parse_test('+31 515 123456', '31', '515', '123456')\n  end\n  # 0516 Oosterwolde\n  # 0517 Franeker\n  # 0518 St. Annaparochie\n  # 0519 Dokkum\n\n  # 0521 Steenwijk\n  def test_steenwijk\n    parse_test('+31 521 123456', '31', '521', '123456')\n  end\n  # 0522 Meppel\n  # 0523 Hardenberg\n  # 0524 Coevorden\n  def tst_coevorden\n    parse_test('+31 524 123456', '31', '524', '123456')\n  end\n  # 0525 Elburg\n  # 0527 Emmeloord\n  # 0528 Hoogeveen\n  # 0529 Ommen\n\n  # 0541 Oldenzaal\n  def test_oldenzaal\n    parse_test('+31 541 123456', '31', '541', '123456')\n  end\n  # 0543 Winterswijk\n  # 0544 Groenlo\n  # 0545 Neede\n  def test_neede\n    parse_test('+31 545 123456', '31', '545', '123456')\n  end\n  # 0546 Almelo\n  # 0547 Goor\n  # 0548 Rijssen\n\n  # 0561 Wolvega\n  def test_wolvega\n    parse_test('+31 561 123456', '31', '561', '123456')\n  end\n  # 0562 Terschelling/Vlieland\n  # 0566 Irnsum\n\n  # 0570 Deventer\n  def test_deventer\n    parse_test('+31 570 123456', '31', '570', '123456')\n  end\n  # 0571 Voorst\n  # 0572 Raalte\n  # 0573 Lochem\n  def test_lochem\n    parse_test('+31 573 123456', '31', '573', '123456')\n  end\n  # 0575 Zutphen\n  # 0577 Uddel\n  # 0578 Epe\n\n  # 0591 Emmen\n  def test_emmen\n    parse_test('+31 591 123456', '31', '591', '123456')\n  end\n  # 0592 Assen\n  # 0593 Beilen\n  def test_beilen\n    parse_test('+31 593 123456', '31', '593', '123456')\n  end\n  # 0594 Zuidhorn\n  # 0595 Warffum\n  # 0596 Appingedam\n  # 0597 Winschoten\n  # 0598 Hoogezand\n  # 0599 Stadskanaal\n  def test_stadskanaal\n    parse_test('+31 599 123456', '31', '599', '123456')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/nz_test.rb",
    "content": "require \"helper\"\n\n## New Zealand\nclass NZTest < Minitest::Test\n  def test_local\n    parse_test('+6431234567',  '64', '3',  '1234567')\n  end\nend\n"
  },
  {
    "path": "test/countries/pt_test.rb",
    "content": "require \"helper\"\n\n## Portugal\n# source 1: http://pt.wikipedia.org/wiki/N%C3%BAmeros_de_telefone_em_Portugal\n# source 2: http://www.anacom.pt/render.jsp?categoryId=279035\n\nclass PTTest < Minitest::Test\n\n  ### Prefixes followed by corresponding tests\n\n  ## 01-09: reserved for future use\n  ## 1: Short Numbers\n\n  ## 2: Landline / fixed numbers\n\n  ## two digits landlines\n  # 21:   Lisbon (Lisboa)\n  def test_lisbon\n    parse_test('+351 21 123 4567', '351', '21', '1234567')\n  end\n  # 22:   Oporto (Porto)\n  def test_oporto\n    parse_test('+351 22 123 4567', '351', '22', '1234567')\n  end\n\n  ## three digits landlines\n  # 231:  Mealhada\n  def test_mealhada\n    parse_test('+351 231 123456', '351', '231', '123456')\n  end\n\n  # 232-295  (Viseu - Angra do Heroismo)\n  def test_viseu\n    parse_test('+351 232 123456', '351', '232', '123456')\n  end\n  def test_angra\n    parse_test('+351 295 123456', '351', '295', '123456')\n  end\n\n  # 296: Ponta Delgada\n  def test_pontadelgada\n    parse_test('+351 296 123456', '351', '296', '123456')\n  end\n\n  ## 3: Nomad services\n  ## 4: Not used\n  ## 5: Free\n  ## 6: Audiotext service, data network access...\n\n  ## 7: Premium numbers (\"Universal access numbers\")\n\n  # 707-708: Premium Numbers\n  def test_707\n    Phoner::Phone.default_country_code = '351'\n    parse_test('707 123 456', '351', '707', '123456')\n  end\n\n  ## 8: Free toll numbers\n\n  # 800: Numero verde (\"Green Number\")\n  def test_800\n    Phoner::Phone.default_country_code = '351'\n    parse_test('800 123 456', '351', '800', '123456')\n  end\n  # 808: Numero azul (\"Blue Number\")\n  def test_808\n    Phoner::Phone.default_country_code = '351'\n    parse_test('808 123 456', '351', '808', '123456')\n  end\n  # 809: Custo partilhado (\"Shared cost\")\n  def test_809\n    Phoner::Phone.default_country_code = '351'\n    parse_test('809 123 456', '351', '809', '123456')\n  end\n\n  ## 9: Mobile networks\n\n  ## two-digits mobile networks\n  # 91: Vodafone\n  def test_vodafone\n    parse_test('+351 91 1234567', '351', '91', '1234567')\n  end\n  # 93: Optimus\n  def test_optimus\n    parse_test('+351 93 1234567', '351', '93', '1234567')\n  end\n  # 96: TMN two-digits\n  def test_tmn\n    parse_test('+351 96 1234567', '351', '96', '1234567')\n  end\n\n  ## three-digits mobile networks\n  # 921: TMN three-digits\n  def test_tmn921\n    parse_test('+351 921 123456', '351', '921', '123456')\n  end\n  # 923-926: TMN three-digits (corporate networks)\n  def test_tmn923\n    parse_test('+351 925 123456', '351', '925', '123456')\n  end\n  # 922: Phone-ix\n  def test_phoneix\n    parse_test('+351 922 123456', '351', '922', '123456')\n  end\n  # 929: Zon Mobile\n  def test_zonmobile\n    parse_test('+351 929 123456', '351', '929', '123456')\n  end\n\n  def test_validates\n    Phoner::Phone.default_country_code = nil\n    assert_equal Phoner::Phone.valid?('00351211234567'), true\n    assert_equal Phoner::Phone.valid?('00351911234567'), true\n    assert_equal Phoner::Phone.valid?('+351931234567'), true\n    assert_equal Phoner::Phone.valid?('+351 (911) 123 456'), true\n    assert_equal Phoner::Phone.valid?('+351921123456'), true\n\n    Phoner::Phone.default_country_code = '351'\n    assert_equal Phoner::Phone.valid?('(931) 234-567'), true\n    assert_equal Phoner::Phone.valid?('(211) 234 567'), true\n    assert_equal Phoner::Phone.valid?('232-123-456'), true\n    assert_equal Phoner::Phone.valid?('232123456'), true\n    assert_equal Phoner::Phone.valid?('92 212 34 56'), true\n    assert_equal Phoner::Phone.valid?('221234567'), true\n    assert_equal Phoner::Phone.valid?('708123456'), true\n    assert_equal Phoner::Phone.valid?('800 123 456'), true\n  end\n\nend\n"
  },
  {
    "path": "test/countries/rs_test.rb",
    "content": "require \"helper\"\n\n## Serbia\nclass RSTest < Minitest::Test\n\n  def test_local\n    # Beograd\n    parse_test('+381 11 24 33 836', '381', '11', '2433836')\n  end\n\n\n  def test_mobile\n    # mts\n    parse_test('+381 648542987', '381', '64', '8542987')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/se_test.rb",
    "content": "# -*- coding: utf-8 -*-\nrequire \"helper\"\n\n## Sweden\nclass SETest < Minitest::Test\n\n  # 08  Greater Stockholm\n  def test_stockholm\n    parse_test('+4685555555', '46', '8', '5555555')\n  end\n\n  ## two digit codes\n\n  # 010 Geographically Independent Numbers / VOIP services\n  def test_independent_numbers\n    parse_test('+46105555555', '46', '10', '5555555')\n  end\n\n  # 011 Norrköping\n  def test_norrkoping\n    parse_test('+46115555555', '46', '11', '5555555')\n  end\n\n  # 013 Linköping\n  def test_linkoping\n    parse_test('+46135555555', '46', '13', '5555555')\n  end\n\n  # 016 Eskilstuna-Torshälla\n  def test_eskilstuna\n    parse_test('+46165555555', '46', '16', '5555555')\n  end\n\n  # 018 Uppsala\n  def test_uppsala\n    parse_test('+46185555555', '46', '18', '5555555')\n  end\n\n  # 019 Örebro-Kumla\n  def test_orebro\n    parse_test('+46195555555', '46', '19', '5555555')\n  end\n\n  # 020 toll-free\n  def test_toll_free\n    parse_test('+46205555555', '46', '20', '5555555')\n  end\n\n  # 021 Västerås\n  def test_vasteras\n    parse_test('+46215555555', '46', '21', '5555555')\n  end\n\n  # 023 Falun\n  def test_falun\n    parse_test('+46235555555', '46', '23', '5555555')\n  end\n\n  # 026 Gävle-Sandviken\n  def test_gavle\n    parse_test('+46265555555', '46', '26', '5555555')\n  end\n\n  # 031 Göteborg\n  def test_goteborg\n    parse_test('+46315555555', '46', '31', '5555555')\n  end\n\n  # 033 Borås\n  def test_boras\n    parse_test('+46335555555', '46', '33', '5555555')\n  end\n\n  # 035 Halmstad\n  def test_halmstad\n    parse_test('+46355555555', '46', '35', '5555555')\n  end\n\n  # 036 Jönköping-Huskvarna\n  def test_jonkoping\n    parse_test('+46365555555', '46', '36', '5555555')\n  end\n\n  # 040 Malmö\n  def test_malmo\n    parse_test('+46405555555', '46', '40', '5555555')\n  end\n\n  # 042 Helsingborg-Höganäs\n  def test_helsingborg\n    parse_test('+46425555555', '46', '42', '5555555')\n  end\n\n  # 044 Kristianstad\n  def test_kristianstad\n    parse_test('+46445555555', '46', '44', '5555555')\n  end\n\n  # 046 Lund\n  def test_lund\n    parse_test('+46465555555', '46', '46', '5555555')\n  end\n\n  # 054 Karlstad\n  def test_karlstad\n    parse_test('+46545555555', '46', '54', '5555555')\n  end\n\n  # 060 Sundsvall-Timrå\n  def test_sundsvall\n    parse_test('+46605555555', '46', '60', '5555555')\n  end\n\n  # 063 Östersund\n  def test_ostersund\n    parse_test('+46635555555', '46', '63', '5555555')\n  end\n\n  # 070,\n  def test_mobile_70\n    parse_test('+46705555555', '46', '70', '5555555')\n  end\n\n  # 071 Telematics in Mobile Networks (used to be Premium rate numbers)\n  def test_telematics\n    parse_test('+46715555555', '46', '71', '5555555')\n  end\n\n  # 072,\n  def test_mobile_72\n    parse_test('+46725555555', '46', '72', '5555555')\n  end\n\n  # 073,\n  def test_mobile_73\n    parse_test('+46735555555', '46', '73', '5555555')\n  end\n\n  # 076  Mobile networks\n  def test_mobile_76\n    parse_test('+46765555555', '46', '76', '5555555')\n  end\n\n  # 090 Umeå\n  def test_umea\n    parse_test('+46905555555', '46', '90', '5555555')\n  end\n\n  # 099 Premium rate calls\n  def test_premium_99\n    parse_test('+46995555555', '46', '99', '5555555')\n  end\n\n  ## three digit codes\n\n  # 0120  Åtvidaberg\n  def test_atvidaberg\n    parse_test('+46120555555', '46', '120', '555555')\n  end\n  # 0121  Söderköping\n  # 0122  Finspång\n  # 0123  Valdemarsvik\n  # 0125  Vikbolandet\n  # 0140  Tranås\n  # 0141  Motala\n  # 0142  Mjölby-Skänninge-Boxholm\n  # 0143  Vadstena\n  # 0144  Ödeshög\n  # 0150  Katrineholm\n  # 0151  Vingåker\n  # 0152  Strängnäs\n  # 0155  Nyköping-Oxelösund\n  # 0156  Trosa-Vagnhärad\n  # 0157  Flen-Malmköping\n  # 0158  Gnesta\n  # 0159  Mariefred\n  # 0171  Enköping\n  def test_enkoping\n    parse_test('+461715555555', '46', '171', '5555555')\n  end\n  # 0173  Öregrund-Östhammar\n  # 0174  Alunda\n  # 0175  Hallstavik-Rimbo\n  # 0176  Norrtälje\n\n  # 0220  Hallstahammar-Surahammar\n  def test_hallstahammar\n    parse_test('+462205555555', '46', '220', '5555555')\n  end\n  # 0221  Köping\n  # 0222  Skinnskatteberg\n  # 0223  Fagersta-Norberg\n  # 0224  Sala-Heby\n  # 0225  Hedemora-Säter\n  # 0226  Avesta-Krylbo\n  # 0227  Kungsör\n  # 0240  Ludvika-Smedjebacken\n  # 0241  Gagnef-Floda\n  # 0243  Borlänge\n  # 0246  Svärdsjö-Enviken\n  # 0247  Leksand-Insjön\n  # 0248  Rättvik\n  def test_rattvik\n    parse_test('+462485555555', '46', '248', '5555555')\n  end\n  # 0250  Mora-Orsa\n  # 0251  Älvdalen\n  # 0253  Idre-Särna\n  # 0258  Furudal\n  # 0270  Söderhamn\n  # 0271  Alfta-Edsbyn\n  # 0278  Bollnäs\n  # 0280  Malung\n  # 0281  Vansbro\n  # 0290  Hofors-Storvik\n  # 0291  Hedesunda-Österfärnebo\n  # 0292  Tärnsjö-Östervåla\n  # 0293  Tierp-Söderfors\n  # 0294  Karlholmsbruk-Skärplinge\n  # 0295  Örbyhus-Dannemora\n  # 0297  Ockelbo-Hamrånge\n  def test_ockelbo\n    parse_test('+462975555555', '46', '297', '5555555')\n  end\n\n  # 0300  Kungsbacka\n  def test_kungsbacka\n    parse_test('+463005555555', '46', '300', '5555555')\n  end\n  # 0301  Hindås\n  # 0302  Lerum\n  # 0303  Kungälv\n  # 0304  Orust-Tjörn\n  # 0320  Kinna\n  # 0321  Ulricehamn\n  # 0322  Alingsås-Vårgårda\n  # 0325  Svenljunga-Tranemo\n  # 0340  Varberg\n  def test_varberg\n    parse_test('+463405555555', '46', '340', '5555555')\n  end\n  # 0345  Hyltebruk-Torup\n  # 0346  Falkenberg\n  # 0370  Värnamo\n  # 0371  Gislaved-Anderstorp\n  # 0372  Ljungby\n  # 0380  Nässjö\n  # 0381  Eksjö\n  # 0382  Sävsjö\n  # 0383  Vetlanda\n  # 0390  Gränna\n  # 0392  Mullsjö\n  # 0393  Vaggeryd\n\n  # 0410  Trelleborg\n  def test_trelleborg\n    parse_test('+464105555555', '46', '410', '5555555')\n  end\n  # 0411  Ystad\n  # 0413  Eslöv-Höör\n  # 0414  Simrishamn\n  # 0415  Hörby\n  # 0416  Sjöbo\n  # 0417  Tomelilla\n  # 0418  Landskrona-Svalöv\n  # 0430  Laholm\n  def test_lanholm\n    parse_test('+464305555555', '46', '430', '5555555')\n  end\n  # 0431  Ängelholm-Båstad\n  # 0433  Markaryd-Strömsnäsbruk\n  # 0435  Klippan-Perstorp\n  # 0451  Hässleholm\n  # 0454  Karlshamn-Olofström\n  # 0455  Karlskrona\n  # 0456  Sölvesborg-Bromölla\n  # 0457  Ronneby\n  # 0459  Ryd\n  # 0470  Växjö\n  def test_vaxjo\n    parse_test('+464705555555', '46', '470', '5555555')\n  end\n  # 0471  Emmaboda\n  # 0472  Alvesta-Rydaholm\n  # 0474  Åseda-Lenhovda\n  # 0476  Älmhult\n  # 0477  Tingsryd\n  # 0478  Lessebo\n  # 0479  Osby\n  # 0480  Kalmar\n  # 0481  Nybro\n  # 0485  Öland\n  # 0486  Torsås\n  # 0490  Västervik\n  # 0491  Oskarshamn-Högsby\n  # 0492  Vimmerby\n  # 0493  Gamleby\n  # 0494  Kisa\n  def test_kisa\n    parse_test('+464945555555', '46', '494', '5555555')\n  end\n  # 0495  Hultsfred-Virserum\n  # 0496  Mariannelund\n  # 0498  Gotland\n  # 0499  Mönsterås\n\n  # 0500  Skövde\n  def test_skovde\n    parse_test('+465005555555', '46', '500', '5555555')\n  end\n  # 0501  Mariestad\n  # 0502  Tidaholm\n  # 0503  Hjo\n  def test_hjo\n    parse_test('+465035555555', '46', '503', '5555555')\n  end\n  # 0504  Tibro\n  # 0505  Karlsborg\n  # 0506  Töreboda-Hova\n  # 0510  Lidköping\n  # 0511  Skara-Götene\n  # 0512  Vara-Nossebro\n  # 0513  Herrljunga\n  # 0514  Grästorp\n  # 0515  Falköping\n  # 0520  Trollhättan\n  # 0521  Vänersborg\n  # 0522  Uddevalla\n  # 0523  Lysekil\n  # 0524  Munkedal\n  # 0525  Grebbestad\n  # 0526  Strömstad\n  # 0528  Färgelanda\n  # 0530  Mellerud\n  # 0531  Bengtsfors\n  # 0532  Åmål\n  # 0533  Säffle\n  # 0534  Ed\n  # 0550  Kristinehamn\n  # 0551  Gullspång\n  # 0552  Deje\n  def test_deje\n    parse_test('+465525555555', '46', '552', '5555555')\n  end\n  # 0553  Molkom\n  # 0554  Kil\n  # 0555  Grums\n  # 0560  Torsby\n  # 0563  Hagfors-Munkfors\n  # 0564  Sysslebäck\n  # 0565  Sunne\n  # 0570  Arvika\n  # 0571  Charlottenberg-Åmotfors\n  # 0573  Årjäng\n  # 0580  Kopparberg\n  # 0581  Lindesberg\n  # 0582  Hallsberg-Pålsboda\n  # 0583  Askersund\n  # 0584  Laxå\n  # 0585  Fjugesta-Svartå\n  # 0586  Karlskoga-Degerfors\n  # 0587  Nora\n  def test_nora\n    parse_test('+465875555555', '46', '587', '5555555')\n  end\n  # 0589  Arboga\n  # 0590  Filipstad\n  # 0591  Hällefors-Grythyttan\n\n  # 0611  Härnösand\n  def test_harnosand\n    parse_test('+466115555555', '46', '611', '5555555')\n  end\n  # 0612  Kramfors\n  # 0613  Ullånger\n  # 0620  Sollefteå\n  # 0621  Junsele\n  # 0622  Näsåker\n  # 0623  Ramsele\n  # 0624  Backe\n  # 0640  Krokom\n  # 0642  Lit\n  # 0643  Hallen-Oviken\n  # 0644  Hammerdal\n  # 0645  Föllinge\n  # 0647  Åre-Järpen\n  # 0650  Hudiksvall\n  # 0651  Ljusdal\n  # 0652  Bergsjö\n  # 0653  Delsbo\n  # 0657  Los\n  # 0660  Örnsköldsvik\n  # 0661  Bredbyn\n  # 0662  Björna\n  # 0663  Husum\n  def test_husum\n    parse_test('+466635555555', '46', '663', '5555555')\n  end\n  # 0670  Strömsund\n  # 0671  Hoting\n  # 0672  Gäddede\n  # 0680  Sveg\n  # 0682  Rätan\n  # 0684  Hede-Funäsdalen\n  # 0687  Svenstavik\n  # 0690  Ånge\n  # 0691  Torpshammar\n  # 0692  Liden\n  # 0693  Bräcke-Gällö\n  # 0695  Stugun\n  # 0696  Hammarstrand\n\n  # 07x(x)  various non-geographical area codes\n  # ambiguous!\n\n  # 074(x)  Pagers\n  def test_pagers\n    parse_test('+467405555555', '46', '740', '5555555')\n  end\n\n  # 0900  Premium rate calls\n  def test_premium_900\n    parse_test('+469005555555', '46', '900', '5555555')\n  end\n  # 0910  Skellefteå\n  # 0911  Piteå\n  # 0912  Byske\n  # 0913  Lövånger\n  # 0914  Burträsk\n  # 0915  Bastuträsk\n  # 0916  Jörn\n  def test_jorn\n    parse_test('+469165555555', '46', '916', '5555555')\n  end\n  # 0918  Norsjö\n  # 0920  Luleå\n  # 0921  Boden\n  # 0922  Haparanda\n  # 0923  Kalix\n  # 0924  Råneå\n  # 0925  Lakaträsk\n  # 0926  Överkalix\n  # 0927  Övertorneå\n  # 0928  Harads\n  # 0929  Älvsbyn\n  # 0930  Nordmaling\n  # 0932  Bjurholm\n  # 0933  Vindeln\n  # 0934  Robertsfors\n  # 0935  Vännäs\n  def test_vannas\n    parse_test('+469355555555', '46', '935', '5555555')\n  end\n  # 0939  Premium rate calls\n  # 0940  Vilhelmina\n  # 0941  Åsele\n  # 0942  Dorotea\n  # 0943  Fredrika\n  # 0944  Premium rate calls\n  # 0950  Lycksele\n  # 0951  Storuman\n  # 0952  Sorsele\n  # 0953  Malå\n  # 0954  Tärnaby\n  # 0960  Arvidsjaur\n  # 0961  Arjeplog\n  # 0970  Gällivare\n  # 0971  Jokkmokk\n  # 0973  Porjus\n  # 0975  Hakkas\n  # 0976  Vuollerim\n  # 0977  Korpilombolo\n  # 0978  Pajala\n  # 0980  Kiruna\n  # 0981  Vittangi\n  def test_vittangi\n    parse_test('+469815555555', '46', '981', '5555555')\n  end\nend\n"
  },
  {
    "path": "test/countries/si_test.rb",
    "content": "require \"helper\"\n\n## Slovenia\nclass SITest < Minitest::Test\n\n  def test_local\n    #Maribor\n    parse_test('+ 386 2 23 46 611', '386', '2', '2346611')\n  end\n\n  def test_local_2\n    # Koper\n    parse_test('+ 386 5 23 46 611', '386', '5', '2346611')\n  end\n\n  def test_mobile\n    # Mobitel\n    parse_test('+386 51 258999', '386', '51', '258999')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/ua_test.rb",
    "content": "require \"helper\"\n\n## Ukraine\nclass UATest < Minitest::Test\n\n  def test_local\n    parse_test('+380 57 711 22 33', '380', '57', '7112233')\n  end\n\n  def test_mobile\n    parse_test('+380-50-111-22-33', '380', '50', '1112233')\n  end\n\n  def test_mobile2\n    parse_test('+380-66-042-22-01', '380', '66', '0422201')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/us_test.rb",
    "content": "require \"helper\"\n\n## United States\nclass USTest < Minitest::Test\n\n  def test_local\n    parse_test('+1 555 123 4567', '1', '555', '1234567')\n  end\n\n  def test_tollfree\n    parse_test('+1 800 555 3456', '1', '800', '5553456')\n  end\n\n  def test_long_with_default_country_code\n    Phoner::Phone.default_country_code = '1'\n    parse_test('2069735100', '1', '206', '9735100')\n  end\n\n  def test_short_with_default_country_code_and_area_code\n    Phoner::Phone.default_country_code = '1'\n    Phoner::Phone.default_area_code = '206'\n    parse_test('9735100', '1', '206', '9735100')\n  end\nend\n"
  },
  {
    "path": "test/countries/uy_test.rb",
    "content": "require \"helper\"\n\n## Uruguay\n# source: http://en.wikipedia.org/wiki/Telephone_numbers_in_Uruguay\nclass UYTest < Minitest::Test\n\n  # 02 Montevideo\n  def test_montevideo\n    parse_test('+598 2 1234567', '598', '2', '1234567')\n  end\n\n  # 042 Maldonado\n  def test_maldonado\n    parse_test('+598 42 123456', '598', '42', '123456')\n  end\n\n  # 09 Mobile phones\n  def test_mobile_phones\n    parse_test('+598 99 570110', '598', '99', '570110')\n  end\n\nend\n"
  },
  {
    "path": "test/countries/za_test.rb",
    "content": "require \"helper\"\n\n## South Africa\nclass ZATest < Minitest::Test\n\n  def test_local\n    # Telkom\n    parse_test('+27 11 555 5555', '27', '11', '5555555')\n  end\n\n  def test_mobile\n    # Vodacom\n    parse_test('+27 82 555 5555', '27', '82', '5555555')\n\n    # Broader cellular ranges past initial allocation given to telecoms service providers\n    parse_test('+27 62 555 5555', '27', '62', '5555555')\n    parse_test('+27 99 555 5555', '27', '99', '5555555')\n  end\n\n  def test_tollfree\n    # Telkom\n    parse_test('+27 800 123 321', '27', '800', '123321')\n  end\n\n  def test_long_msisdns\n    parse_test('+279602007648699', '27', '96', '02007648699')\n  end\n\nend\n"
  },
  {
    "path": "test/extension_test.rb",
    "content": "require \"helper\"\n\nclass ExtensionTest < Minitest::Test\n\n  def test_parse_usa_long_with_simple_extension\n    pn = Phoner::Phone.parse \"+1 2069735100 x143\"\n\n    refute_nil pn, %Q{parse should pass}\n    assert_equal '9735100', pn.number\n    assert_equal '206', pn.area_code\n    assert_equal '1', pn.country_code\n    assert_equal '143', pn.extension\n  end\n\n  def test_to_s_with_extension\n    pn = Phoner::Phone.new '5125486', '91', '385', '143'\n    assert_equal '+385915125486x143', pn.format(:default_with_extension)\n  end\n\n  def test_format_with_extension\n    pn = Phoner::Phone.new '5125486', '91', '385', '143'\n    assert_equal '(091)/512-5486 x 143', pn.format('(%A)/%f-%l x %x')\n  end\n\n  def test_extract_extension\n    string = \"+1 2069735100 x143\"\n    number, ext = Phoner::Phone.extract_extension(string)\n\n    assert_equal \"+1 2069735100 x143\", string\n    assert_equal \"+1 2069735100\", number\n    assert_equal \"143\", ext\n  end\nend\n"
  },
  {
    "path": "test/helper.rb",
    "content": "require \"rubygems\"\n\nbegin\n  require \"bundler\"\nrescue LoadError => e\n  STDERR.puts e.message\n  STDERR.puts \"Run `gem install bundler` to install Bundler.\"\n  exit e.status_code\nend\n\nbegin\n  Bundler.setup(:default, :development, :test)\nrescue Bundler::BundlerError => e\n  STDERR.puts e.message\n  STDERR.puts \"Run `bundle install` to install missing gems.\"\n  exit e.status_code\nend\n\nrequire \"phone\"\nrequire \"minitest/autorun\"\n\nclass Minitest::Test\n  def setup\n    Phoner::Phone.default_country_code = nil\n    Phoner::Phone.default_area_code = nil\n  end\n\n  def teardown\n    Phoner::Phone.default_country_code = nil\n    Phoner::Phone.default_area_code = nil\n  end\nend\n\ndef parse_test(raw, country_code, area_code, number)\n  pn = Phoner::Phone.parse(raw)\n\n  refute_nil pn, %Q{parse should pass}\n  assert_equal country_code, pn.country_code\n  assert_equal area_code, pn.area_code\n  assert_equal number, pn.number\nend\n"
  },
  {
    "path": "test/phone_test.rb",
    "content": "require \"helper\"\n\nclass PhoneTest < Minitest::Test\n\n  def test_with_nil_number_initialize\n    assert_raises Phoner::BlankNumberError do\n      Phoner::Phone.new nil\n    end\n  end\n\n  def test_with_empty_number_initialize\n    assert_raises Phoner::BlankNumberError do\n      Phoner::Phone.new \"\"\n    end\n  end\n\n  def test_number_without_country_code_initialize\n    Phoner::Phone.default_country_code = nil\n\n    assert_raises Phoner::CountryCodeError do\n      Phoner::Phone.new '5125486', '91'\n    end\n  end\n\n  def test_number_without_country_and_area_code_initialize\n    Phoner::Phone.default_country_code = nil\n    Phoner::Phone.default_area_code = nil\n\n    assert_raises Phoner::AreaCodeError do\n      Phoner::Phone.new '451588'\n    end\n  end\n\n  def test_number_with_default_area_code_initialize\n    Phoner::Phone.default_country_code = '385'\n    Phoner::Phone.default_area_code = '47'\n\n    pn = Phoner::Phone.new '451588'\n    assert pn.number == '451588'\n    assert pn.area_code == '47'\n    assert pn.country_code == '385'\n  end\n\n  def test_number_with_default_country_code_initialize\n    Phoner::Phone.default_country_code = '386'\n\n    pn = Phoner::Phone.new '5125486', '91'\n    assert pn.number == '5125486'\n    assert pn.area_code == '91'\n    assert pn.country_code == '386'\n  end\n\n  def test_number_with_country_code_initialize\n    Phoner::Phone.default_country_code = '387'\n\n    pn = Phoner::Phone.new '5125486', '91', '385'\n    assert pn.number == '5125486'\n    assert pn.area_code == '91'\n    assert pn.country_code == '385'\n  end\n\n  def test_parse_empty\n    assert_nil Phoner::Phone.parse('')\n    assert_nil Phoner::Phone.parse(nil)\n  end\n\n  def test_parse_with_special_characters_with_country\n    pn = Phoner::Phone.parse \"+1 545-545-5454\"\n    assert \"1\", pn.country_code\n    assert \"545\", pn.area_code\n    assert \"5455454\", pn.number\n  end\n\n  def test_parse_with_extension\n    pn = Phoner::Phone.parse \"+1 545-545-5454 ext. 4307\"\n    assert \"1\", pn.country_code\n    assert \"545\", pn.area_code\n    assert \"5455454\", pn.number\n    assert \"4307\", pn.extension\n  end\n\n  def test_parse_wont_alter_parameter\n    number = \"+1 545-545-5454 ext. 4307\"\n    _parsed = Phoner::Phone.parse number\n    assert_equal \"+1 545-545-5454 ext. 4307\", number\n  end\n\n  def test_parse_short_without_special_characters_without_country\n    Phoner::Phone.default_country_code = nil\n\n    assert_raises Phoner::CountryCodeError do\n      Phoner::Phone.parse \"0915125486\"\n    end\n  end\n\n  def test_parse_short_with_special_characters_without_country\n    Phoner::Phone.default_country_code = nil\n\n    assert_raises Phoner::CountryCodeError do\n      Phoner::Phone.parse \"091/512-5486\"\n    end\n  end\n\n  def test_normalize\n    numbers = [\n      [\"(0)512-5486\", \"5125486\"],\n      [\"z512-5486\", \"5125486\"],\n      [\"00512-5486\", \"+5125486\"],\n      [\"+00512-5486\", \"+5125486\"],\n      [\"+0512-5486\", \"+5125486\"],\n    ]\n\n    numbers.each do |number, expected|\n      assert_equal expected, Phoner::Phone.normalize(number)\n    end\n  end\n\n  def test_to_s\n    Phoner::Phone.default_country_code = nil\n    pn = Phoner::Phone.new '5125486', '91', '385'\n    assert pn.to_s == '+385915125486'\n  end\n\n  def test_to_s_without_country_code\n    Phoner::Phone.default_country_code = '385'\n    pn = Phoner::Phone.new '5125486', '91'\n    assert pn.format(\"0%a%n\") == '0915125486'\n  end\n\n  def test_format_special_with_country_code\n    Phoner::Phone.default_country_code = nil\n    pn = Phoner::Phone.new '5125486', '91', '385'\n    assert pn.format(\"+ %c (%a) %n\") == '+ 385 (91) 5125486'\n  end\n\n  def test_format_special_without_country_code\n    Phoner::Phone.default_country_code = '385'\n    pn = Phoner::Phone.new '5125486', '91'\n    assert_equal pn.format(\"%A/%f-%l\"), '091/512-5486'\n  end\n\n  def test_format_with_symbol_specifier\n    Phoner::Phone.default_country_code = nil\n    pn = Phoner::Phone.new '5125486', '91', '385'\n    assert_equal pn.format(:europe), '+385 (0) 91 512 5486'\n  end\n\n  def test_validity\n    assert true, Phoner::Phone.valid?(\"+17788827175\")\n  end\n\n  def test_successful_validity_wont_alter_parameter\n    number = \"+17755551212\"\n    Phoner::Phone.valid?(number)\n    assert_equal \"+17755551212\", number\n  end\n\n  def test_failing_validity_wont_alter_parameter\n    number = \"ABC123\"\n    Phoner::Phone.valid?(number)\n    assert_equal \"ABC123\", number\n  end\n\n  def test_validity_with_country_code\n    assert true, Phoner::Phone.valid?(\"7788827175\", :country_code => \"1\")\n  end\n\n  def test_doesnt_validate\n    assert_equal Phoner::Phone.valid?('asdas'), false\n    assert_equal Phoner::Phone.valid?('385915125486'), false\n  end\n\n  def test_valid_wont_strip_the_extension\n    number = '+1 (123) 456-7890 x321'\n\n    parsed = Phoner::Phone.parse(number)\n    assert_equal \"+11234567890\", parsed.to_s\n    assert_equal \"321\", parsed.extension\n\n    assert Phoner::Phone.valid?(number)\n\n    parsed = Phoner::Phone.parse(number)\n    assert_equal \"+11234567890\", parsed.to_s\n    assert_equal\"321\", parsed.extension\n  end\n\n  def test_comparison_true\n    pn1 = Phoner::Phone.new '5125486', '91', '385'\n    pn2 = Phoner::Phone.new '5125486', '91', '385'\n    assert pn1 == pn2\n  end\n\n  def test_comparison_false\n    pn1 = Phoner::Phone.new '5125486', '91', '385'\n    pn2 = Phoner::Phone.new '1234567', '91', '385'\n    assert pn1 != pn2\n  end\n\n  def test_find_by_country_isocode\n    Phoner::Country.load\n    assert_equal Phoner::Country.find_by_country_isocode('de').country_code, \"49\"\n    assert_nil Phoner::Country.find_by_country_isocode('xx')\n    assert_nil Phoner::Country.find_by_country_isocode('bla')\n  end\nend\n"
  },
  {
    "path": "test_usa_phones_with_extensions.csv",
    "content": "601-867-5000 ext 75292\n(334)821-2223 Ext. 107\n(863) 983-6171 ext: 0055\n601-987-3995 ext 10\n(512) 473-3200Ext2396\n(727) 558-5010 ext: 0112\n(904) 360-5611 ext: 5611\n(937) 255-7204Ext337\n228-374-5022 ext 5386\n(205)987-3500 Ext. 205-32\n(607) 273-8588x402\n(205)328-3330 Ext. 802-59\n(407) 251-2452 ext: 0146\n502-564-8110 xt 312\n(828) 698-3923x13\n(608)836-7433 Ext. 5147\n(1-808)935-3222 Ext. 2#\n(770)420-3179 Ext. x 179\n(415) 558-8669x218\n(205)879-6330 Ext. 731-50\n(205)987-5995 Ext. 802-58\n(609) 924-2200Ext10\n(312) 440-4373x12\n(978) 369-9602x457\n1-602-264-1774 # 135\n502-564-8890 x4340\n502-564-5550 x4569\n(480)437-2600 Ext. VM123\n(850) 245-4131 ext: 3506\n601-354-6161 ext 103\n(414)778-5400 Ext. 127\n(262)338-4475 Ext. #16\n(602) 264-1774 extention # 135\n(314) 361-3221x107\n(800) 255-5747x46\n410-514-7336 TDDTTY + Voice\n(617) 695-2300x393\n1-334-386-8800 Ext. 107\n(928)634-9536 Ext. 143\n502-573-1555 x266\n(978) 927-8000x246\n(920) 887-4600Ext340\n502-564-1404 x4536\n(850) 245-6774 ext: 4774\n(718) 852-3000 Ext 269\n228-374-5022 ext 5022\n502-564-0105 x10260\n(850) 000-0000 ext: 00000000\n(979) 233-1616x306\n(207) 333-3267x224\n(561) 625-5122 ext: 687\n(386) 961-7414 ext: 7414\n(262)549-2249 Ext. 104\n(205)322-7500 Ext. BECKYS\n(303)858-8100 Ext. n.a.\n(937) 255-7204x337\n601-944-4830 ext 104\n228-432-1056 ext 104\n(209) 586-1495Ext104\n502-564-8139 : 4645\n(602) 264-1774 ext is 135\n(602) 264-1774Ext135\n502-564-7822 x4212\n(609) 921-8808Ext3\n(703) 739-7900x222\n(609) 758-2241x144\n(970)223-6500 Ext. X6510\n(734) 485-2000Ext255\n(904) 620-4424 ext: 8614424\n(904) 827-2520 ext: 2520\n(978) 774-1050x251\n(541) 343-0123x2269\n(608)277-2752 Ext. 2752\n(203) 869-6786x335\n502-564-5981 x272\n606-878-5908 x6085\n502-564-2257 x3464\n(205)871-1911 Ext. (205)\n502-564-7770 x3965\n(608)374-2130 Ext. 28\n(850) 410-9660 ext: 9240\n601-987-6837 ext 102\n(414)529-1101 Ext. 153\n(209) 586-1495x104\n(520)408-1885 Ext. # 227\n601-605-5388 ext 100\n(352) 375-8484 ext: 0174\n15025645981x225\n(602) 264-1774 X 135\n(205)803-1499 Ext. 414-03\n(651) 459-4121x203\n+61 3 9811 2400\n(262)681-2020 Ext. 6682\n601-944-4845 ext 118\n384-1100 VOICE MAIL:3004\n(205)251-1267 Ext. 802-09\n(410) 280-2038Ext11\n502-564-3170 x190\n15025646734x4420\n"
  }
]