diff --git a/history.textile b/history.textile index 2227f1d2..fd82c0e0 100644 --- a/history.textile +++ b/history.textile @@ -1,3 +1,7 @@ +h2. Version 2.21.0 + +* Fail plausible? if more than 1 + exists in a number. + h2. Version 2.20.15 * Pakistan (#531) diff --git a/lib/phony/country_codes.rb b/lib/phony/country_codes.rb index 0738d791..52be4c3d 100644 --- a/lib/phony/country_codes.rb +++ b/lib/phony/country_codes.rb @@ -94,6 +94,11 @@ def format(number, options = {}) # Is this number plausible? # def plausible?(number, hints = {}) + # Fail if it contains too many of certain phone specific markers: + # * more than 1 + + # + return false if number.count('+') > 1 + normalized = clean number # False if it fails the basic check. diff --git a/phony.gemspec b/phony.gemspec index 9049537c..b4e4820c 100644 --- a/phony.gemspec +++ b/phony.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'phony' - s.version = '2.20.15' + s.version = '2.21.0' s.authors = ['Florian Hanke'] s.email = 'florian.hanke+phony@gmail.com' s.homepage = 'https://github.com/floere/phony' diff --git a/qed/plausibility.md b/qed/plausibility.md index 992a7805..9978fd0d 100644 --- a/qed/plausibility.md +++ b/qed/plausibility.md @@ -41,6 +41,10 @@ The number is not considered plausible if it does not contain given `ccc`. Phony.refute.plausible?('+1 868 7620266', ccc: '1869') Phony.refute.plausible?('+1 869 7620266', ccc: '1868') +### duplicated cc + + Phony.refute.plausible?('+49+491505632832') + ### Example countries Some of the examples use `plausible? true: [some numbers]`.