BIG PHONEY

Parse phone numbers with Ruby.

It's a work in progress...

But! Here's what you can do:

phone = PhoneNumber.new('20 484-123-1234 x 123')
phone.number        # => "4841231234"
phone.area_code     # => "484"
phone.extension     # => "123"
phone.country_code  # => "20"
phone.to_s          # => "+20 (484) 123-1234 ext. 123"

Also, check validity:

phone = PhoneNumber.new('12345')
phone.valid? # => false
phone.errors # => [:too_short]

The formatting and prefix type splitting stuff is still very US-centric. That will change as the need arises (or as you send me a pull request, you awesome developer you).

(Code heavily inspired by http://github.com/gitpan/Parse-PhoneNumber)