Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,11 @@
one_of(%w[92 97]) >> split(3) | # mobile
fixed(2) >> split(3, 3)

country '975', fixed(1) >> split(3, 3) # Bhutan (Kingdom of) http://www.wtng.info/wtng-975-bt.html
# Bhutan (Kingdom of)
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Bhutan
country '975',
one_of(%w(16 17 77)) >> split(3, 3) | # Mobile
one_of(%w(2)) >> split(3, 3) # Landline

# Mongolia
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MN
Expand Down
13 changes: 12 additions & 1 deletion qed/plausibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,18 @@ NDC with several subscriber number length.

#### Bhutan

plausible? true: '+975 2 889 648'
https://en.wikipedia.org/wiki/Telephone_numbers_in_Bhutan

Phony.assert.plausible?("+975 2 889 648") # Landline
Phony.assert.plausible?("+975 17 889 648") # B-Mobile
Phony.assert.plausible?("+975 16 889 648") # B-Mobile
Phony.assert.plausible?("+975 77 889 648") # TashiCell

Phony.refute.plausible?("+975 77 889 6489") # B-Mobile (too long)
Phony.refute.plausible?("+975 77 889 64") # B-Mobile (too short)
Phony.refute.plausible?("+975 3 889 648") # Not a landline
Phony.refute.plausible?("+975 2 889 64") # Landline too short
Phony.refute.plausible?("+975 2 889 6489") # Landline too long

#### Bolivia

Expand Down
5 changes: 4 additions & 1 deletion spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,10 @@ def self.it_splits(number, expected)
end

describe 'Bhutan (Kingdom of)' do
it_splits '9759723642', %w[975 9 723 642]
it_splits '9752972364', %w(975 2 972 364)
it_splits '97516297236', %w(975 16 297 236)
it_splits '97517297236', %w(975 17 297 236)
it_splits '97577297236', %w(975 77 297 236)
end

describe 'Brunei Darussalam' do
Expand Down