to_phone 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/extensions/float.rb +6 -1
- data/lib/extensions/integer.rb +5 -0
- data/lib/extensions/nil.rb +5 -1
- data/lib/extensions/string.rb +5 -0
- data/lib/to_phone.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f6ccc54082ccb63b2b5e92feb8676326f7cc130
|
4
|
+
data.tar.gz: a4be12bbf9af1fb19313cfb3f6515e93387e798d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f60211b20828b6a2bfecc29ef838807bac690da366408059688a7a80fe7778cc91a8dd1c3910c1bf419c40e8bba12e4ed97d2e455e278caa3ed94b1fb2213906
|
7
|
+
data.tar.gz: c1caa33e7d9a759a8828254d3ed6ca6e2069960c4cb1d143dbd704d4a3771a08de769833cd7b7579a15493ce4a4b06d8603eee5a09b01d94d704cccf8d487171
|
data/lib/extensions/float.rb
CHANGED
data/lib/extensions/integer.rb
CHANGED
data/lib/extensions/nil.rb
CHANGED
data/lib/extensions/string.rb
CHANGED
data/lib/to_phone.rb
CHANGED
@@ -13,8 +13,11 @@ module ToPhone
|
|
13
13
|
|
14
14
|
def self.to_phone number, country_code = '1'
|
15
15
|
begin
|
16
|
+
number = number.strip
|
17
|
+
country_code = country_code.strip
|
16
18
|
country_code = '1' if country_code.nil? || country_code.empty?
|
17
19
|
country_code = country_code.to_s
|
20
|
+
number = number[country_code.length..-1] if number[0..country_code.length] == country_code
|
18
21
|
phone = Phoner::Phone.parse(number, country_code: country_code)
|
19
22
|
return phone
|
20
23
|
rescue Phoner::PhoneError
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_phone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Schreiber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phone
|