Ruby libphonenumber wrapper with ExecJS.
Add this line to your application's Gemfile:
gem 'fakie'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fakie
> phone = Fakie.parse('415-555-0123', default_country: 'US')
#=> <Fakie::PhoneNumber @country_code=1, @national_number=4155550123, @raw_input="415-555-0123", @country_code_source=20, @preferred_domestic_carrier_code="", @is_possible=true, @is_valid=true, @region_code="US", @type="FIXED_LINE_OR_MOBILE">
> phone.e164
=> "+14155550123"
> phone.country_code
> 1
> phone.local_format
=> "(415) 555-0123"
> phone.internation_format
=> "+1 415-555-0123"
> phone.country_name
=> "United States"
Fakie is tested under 1.8.7, 1.9.2, 1.9.3, 2.0.0, JRuby 1.7.2 (1.9 mode), and Rubinius 2.0.0 (1.9 mode).
See the contributing guide.
To update libphonenumber, simply run rake import
. It will download and build the neccessary files. You'll need closure-compiler installed to do it.