phonelib 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +3 -2
- data/data/extended_data.dat +0 -0
- data/data/libphonenumber/README.md +2 -2
- data/data/libphonenumber/cpp/src/phonenumbers/lite_metadata.cc +9378 -9374
- data/data/libphonenumber/cpp/src/phonenumbers/metadata.cc +10179 -10175
- data/data/libphonenumber/cpp/src/phonenumbers/short_metadata.cc +2322 -2321
- data/data/libphonenumber/cpp/test/phonenumbers/shortnumberinfo_test.cc +4 -2
- data/data/libphonenumber/java/carrier/pom.xml +4 -4
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/232_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/65_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/972_en +0 -0
- data/data/libphonenumber/java/demo/pom.xml +5 -5
- data/data/libphonenumber/java/geocoder/pom.xml +4 -4
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1220_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1628_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1629_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/config +0 -0
- data/data/libphonenumber/java/internal/prefixmapper/pom.xml +3 -3
- data/data/libphonenumber/java/libphonenumber/pom.xml +2 -2
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HU +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SL +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_BI +0 -0
- data/data/libphonenumber/java/pom.xml +1 -1
- data/data/libphonenumber/java/release_notes.txt +9 -0
- data/data/libphonenumber/javascript/i18n/phonenumbers/asyoutypeformatter_test.js +6 -4
- data/data/libphonenumber/javascript/i18n/phonenumbers/demo-compiled.js +82 -82
- data/data/libphonenumber/javascript/i18n/phonenumbers/metadata.js +14 -14
- data/data/libphonenumber/javascript/i18n/phonenumbers/metadatalite.js +14 -14
- data/data/libphonenumber/resources/PhoneNumberMetadata.xml +34 -20
- data/data/libphonenumber/resources/ShortNumberMetadata.xml +17 -7
- data/data/libphonenumber/resources/carrier/en/232.txt +8 -0
- data/data/libphonenumber/resources/carrier/en/65.txt +188 -0
- data/data/libphonenumber/resources/carrier/en/972.txt +2 -0
- data/data/libphonenumber/resources/geocoding/en/1.txt +3 -0
- data/data/libphonenumber/resources/geocoding/en/86.txt +8219 -1528
- data/data/libphonenumber/resources/geocoding/zh/86.txt +7262 -569
- data/data/phone_data.dat +0 -0
- data/lib/phonelib/phone.rb +4 -1
- data/lib/phonelib/version.rb +1 -1
- metadata +5 -2
data/data/phone_data.dat
CHANGED
Binary file
|
data/lib/phonelib/phone.rb
CHANGED
@@ -124,6 +124,8 @@ module Phonelib
|
|
124
124
|
|
125
125
|
# Returns e164 formatted phone number
|
126
126
|
def international
|
127
|
+
sanitized = self.sanitized
|
128
|
+
return nil if sanitized.nil? || sanitized.empty?
|
127
129
|
return "+#{sanitized}" unless valid?
|
128
130
|
|
129
131
|
format = @data[country][:format]
|
@@ -139,7 +141,8 @@ module Phonelib
|
|
139
141
|
|
140
142
|
# Returns e164 unformatted phone number
|
141
143
|
def e164
|
142
|
-
international
|
144
|
+
international = self.international
|
145
|
+
international and international.gsub /[^+0-9]/, ''
|
143
146
|
end
|
144
147
|
|
145
148
|
# Returns whether a current parsed phone number is valid for specified
|
data/lib/phonelib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phonelib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vadim Senderovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -422,6 +422,7 @@ files:
|
|
422
422
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1217_en
|
423
423
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1218_en
|
424
424
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1219_en
|
425
|
+
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1220_en
|
425
426
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1224_en
|
426
427
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1225_en
|
427
428
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1226_en
|
@@ -583,6 +584,8 @@ files:
|
|
583
584
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1620_en
|
584
585
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1623_en
|
585
586
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1626_en
|
587
|
+
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1628_en
|
588
|
+
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1629_en
|
586
589
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1630_en
|
587
590
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1631_en
|
588
591
|
- data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1636_en
|