Skip to content
Closed
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
1 change: 1 addition & 0 deletions lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@
match(/^([7-9]0\d)\d+$/) >> split(3, 4) | # Mobile
match(/^(81\d)\d+$/) >> split(3, 4) | # Mobile
match(/^(91\d)\d+$/) >> split(3, 4) | # Mobile
one_of('20') >> split(3, 3..5) | # 2-digit NDC (area code 20) - must come before 1-digit '2'
one_of('1', '2') >> split(3, 3..4) | # Lagos, Ibadan
one_of('9') >> split(3, 4) | # Abuja
one_of((30..79).map(&:to_s)) >> split(3, 2..3) | # 2-digit NDC
Expand Down
3 changes: 2 additions & 1 deletion spec/functional/plausibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ def self.it_is_correct_for(country_name, options = {})
'+234 811 234 5678',
'+234 64 830 00',
'+234 1 280 444',
'+234 85 123 456']
'+234 85 123 456',
'+234 20 123 456']
it_is_correct_for 'Niue', samples: '+683 3791'
it_is_correct_for 'Oman', samples: ['+968 24 423 123',
'+968 25 423 123']
Expand Down
3 changes: 3 additions & 0 deletions spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,9 @@ def self.it_splits(number, expected)
describe 'Nigeria' do
it_splits '23411231234', %w[234 1 123 1234] # Lagos

it_splits '23420123456', %w[234 20 123 456] # Area code 20 (7 digits)
it_splits '2342013438806', %w[234 20 134 38806] # Area code 20 (8 digits, from Z2 ticket #14715836)

it_splits '23445123456', %w[234 45 123 456] # Ogoja

# mobile numbers
Expand Down
Loading