phonelib 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phonelib/phone.rb +6 -1
- data/lib/phonelib/version.rb +1 -1
- 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: ccfbb63011fdac1db8de4f38b768c5d8f3f52bd0
|
4
|
+
data.tar.gz: fa764e739265e75cad4bd2ca316818fc2a8bd070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc7572c868a1ab9372b75500564763f1857fa3e206d10c336b234e14d1dcd6be672ae20925b6f849a26b37a83835275b139de6ecc65e79e32b5d747a8dae9885
|
7
|
+
data.tar.gz: 7b11286b0105dcd57cdcbd370884cb2261f17063f5edf00981a4634a5c7829a07f13c75a913dddf3943179a9ae99303528870651a925dfa49200b59863578f50
|
data/lib/phonelib/phone.rb
CHANGED
@@ -154,7 +154,7 @@ module Phonelib
|
|
154
154
|
# Returns e164 formatted phone number
|
155
155
|
def international(formatted = true)
|
156
156
|
return nil if sanitized.nil? || sanitized.empty?
|
157
|
-
return "+#{
|
157
|
+
return "+#{country_prefix_or_not}#{sanitized}" unless valid?
|
158
158
|
return "#{@data[country][Core::COUNTRY_CODE]}#{@national_number}" unless formatted
|
159
159
|
|
160
160
|
format = @data[country][:format]
|
@@ -218,6 +218,11 @@ module Phonelib
|
|
218
218
|
|
219
219
|
private
|
220
220
|
|
221
|
+
def country_prefix_or_not
|
222
|
+
return '' unless country_code
|
223
|
+
sanitized.start_with?(country_code) ? '' : country_code
|
224
|
+
end
|
225
|
+
|
221
226
|
# returns extension with separator defined
|
222
227
|
def formatted_extension
|
223
228
|
return '' if @extension.nil? || @extension.empty?
|
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.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vadim Senderovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|