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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe5885c87757e67c73cb3496b0712f94638a10e6
4
- data.tar.gz: 286eba0f0f029b2c13121a8a41908422304f79f3
3
+ metadata.gz: ccfbb63011fdac1db8de4f38b768c5d8f3f52bd0
4
+ data.tar.gz: fa764e739265e75cad4bd2ca316818fc2a8bd070
5
5
  SHA512:
6
- metadata.gz: cf7e4400848c0db0f47414c65e567e9a6a511ee0178735c76402a7ecc54ea55cfba2969f41ac7b4b90b9937f5178cfde7b2b71e0beb2c6f2f535b25d8056be15
7
- data.tar.gz: a9247b8ebd4d33adc94b330157bf00e70087188eac55f253bc8f8417b347289efd8add055f9d4f5d25e9dda728fe6d3b4ac20d012eeb74b3765e02f135202418
6
+ metadata.gz: cc7572c868a1ab9372b75500564763f1857fa3e206d10c336b234e14d1dcd6be672ae20925b6f849a26b37a83835275b139de6ecc65e79e32b5d747a8dae9885
7
+ data.tar.gz: 7b11286b0105dcd57cdcbd370884cb2261f17063f5edf00981a4634a5c7829a07f13c75a913dddf3943179a9ae99303528870651a925dfa49200b59863578f50
@@ -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 "+#{sanitized.start_with?(country_code) ? '' : country_code}#{sanitized}" unless valid?
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?
@@ -1,5 +1,5 @@
1
1
  # :nodoc:
2
2
  module Phonelib
3
3
  # :nodoc:
4
- VERSION = '0.6.1'
4
+ VERSION = '0.6.2'
5
5
  end
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.1
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-04 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake