Sha256: 64824b66c9050dd5a2cae773a1a4f6e81fd491e4d4a90f063ea089e22a955d47

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# as_dialed_from [![Build Status](https://secure.travis-ci.org/Movitas/as_dialed_from.png)](https://secure.travis-ci.org/Movitas/as_dialed_from)

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.

```rb
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

```sh
gem install as_dialed_from
```

### Gemfile

```rb
gem 'as_dialed_from'
```

And then `bundle install`

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
as_dialed_from-0.2.4 README.md
as_dialed_from-0.2.3 README.md
as_dialed_from-0.2.2 README.md