Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A Ruby gem that provides parsing and output of North American Numbering Plan (NANP) phone numbers, and includes location and time zones.
Failed to load latest commit information.
data/dialable Bumped version to make sure you have the latest nanpa.yaml, fixed wei…
spec Replaced coveralls w/ simplecov
support Updated gemspec, Rakefile, switched to rspec 2, ruby 1.9, added more …
.travis.yml Removed ruby-head and jruby-head from travis list.
Gemfile Split up 2 tests so that daylight savings time / standard time are ch…
Gemfile.lock Replaced coveralls w/ simplecov
LICENSE holy newgem batman
README.rdoc Replaced coveralls w/ simplecov
Rakefile Split up 2 tests so that daylight savings time / standard time are ch…
dialable.gemspec Replaced coveralls w/ simplecov



Gem Version

A gem that provides parsing and output of phone numbers according to NANPA standards.

Phone numbers are not a big deal if you can validate the input at the time you've got a human right there. My enterprise tends not to have that ability, as we receive large files from clients with little or no validation done. Rather than abandon #s which don't validate, I wrote this to parse and normalize a string into a standard NANP phone number, possibly including an extension.

References: NANPA: North American Numbering Plan Administration

The YAML file with the valid area codes and easily recognizable codes (like 911) can get out of date. To update your own copy, run:

support/make_yaml_nanpa.rb > data/nanpa.yaml

require “dialable”

pn = Dialable::NANP.parse(“+1(800)555-1212 ext 1234”)

>> puts pn.to_s // Pretty output

800-555-1212 x1234

>> puts pn.to_digits // Address book friendly

8005551212 x1234

>> puts pn.to_dialable // PBX friendly


>> puts pn.extension


Also, pn.timezones and pn.relative_timezones should do the right thing.


Something went wrong with that request. Please try again.