Skip to content

Commit

Permalink
2.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Jan 3, 2025
1 parent 3f38be6 commit 9f95a1b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions history.textile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
5 changes: 5 additions & 0 deletions lib/phony/country_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion phony.gemspec
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'
s.homepage = 'https://github.com/floere/phony'
Expand Down
4 changes: 4 additions & 0 deletions qed/plausibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]`.
Expand Down

0 comments on commit 9f95a1b

Please sign in to comment.