phony_rails 0.12.2 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/phony_rails.rb +4 -2
- data/lib/phony_rails/version.rb +1 -1
- data/spec/lib/phony_rails_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2355478441210acbafebb74435193835a27a3b6f
|
4
|
+
data.tar.gz: ad9a7043b6fdda221b8283ed9f1f6ac359f6ac52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be3de636fac977f1b2f0cb1f9c3179aa9a076609b523e8a8e4bf43550057d9edb4d4651d2c03fe9fdcec479730bafc54b2d766b10465060950b129ee4f26b526
|
7
|
+
data.tar.gz: aacfe26b61f9a7b87c31ff7d0f7eded00c0fffa5bad37bd04f3e80b3cade8cfbf2335ff1a6d60d06050c3a5c140471df3a6203b2008af1bf196d510ac84c2cb7
|
data/Gemfile.lock
CHANGED
data/lib/phony_rails.rb
CHANGED
@@ -35,8 +35,10 @@ module PhonyRails
|
|
35
35
|
options[:add_plus] = true if options[:add_plus].nil?
|
36
36
|
# We try to add the default country number and see if it is a
|
37
37
|
# correct phone number. See https://github.com/joost/phony_rails/issues/87#issuecomment-89324426
|
38
|
-
if
|
39
|
-
|
38
|
+
if not (number =~ /\A\+/) # if we don't have a +
|
39
|
+
if Phony.plausible?("#{_default_country_number}#{number}") || !Phony.plausible?(number) || country_code_from_number(number).nil?
|
40
|
+
number = "#{_default_country_number}#{number}"
|
41
|
+
end
|
40
42
|
end
|
41
43
|
# number = "#{_default_country_number}#{number}" unless Phony.plausible?(number)
|
42
44
|
end
|
data/lib/phony_rails/version.rb
CHANGED
@@ -106,6 +106,7 @@ describe PhonyRails do
|
|
106
106
|
it "should pass Github issue #87" do
|
107
107
|
PhonyRails.normalize_number('2318725305', country_code: 'US').should eq('+12318725305')
|
108
108
|
PhonyRails.normalize_number('2318725305', default_country_code: 'US').should eq('+12318725305')
|
109
|
+
PhonyRails.normalize_number('+2318725305', default_country_code: 'US').should eq('+2318725305')
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|