0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Figure out how a number should be dialed from another country. A fork of a port of Google's libphonenumber.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

 Project Readme

as_dialed_from Build Status

Figure out how a number should be dialed from another country. A fork of a port of Google's libphonenumber.

Warning

Not all country combinations work correctly. Contributions welcome.

Examples

as_dialed_from prototypes the String class with an as_dialed_from method.

require 'as_dialed_from'

"+12155551212".as_dialed_from "US"
 => "12155551212"

"+12155551212".as_dialed_from 52 # Mexico
 => "0012155551212"
 
"+12155551212".as_dialed_from "74957285000" # Russia
 => "8~1012155551212"

The "from" argument can be one of many things

  • An ISO 3166-2 code ("US")
  • Any valid country code digits, as an Integer (1) or String ("1")
  • If a phone number is passed, it will try to find the country code for that number ("12155551212")

Installing

Shell

gem install as_dialed_from

Gemfile

gem 'as_dialed_from'

And then bundle install