Skip to content

Commit

Permalink
Merge 92cab12 into 41da50a
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeydgr8 committed Apr 22, 2019
2 parents 41da50a + 92cab12 commit 29998d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1183,9 +1183,9 @@
# Israel (State of) (also works for numbers in Palestinian territories)
country '972',
trunk('0') |
one_of('1') >> split(3,3,3) | # special numbers
one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4) # 2 digit ndc
one_of('1') >> split(3,3,3) | # special numbers
one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
match(/^(5[012345689]|7[234679])\d+$/) >> split(3,4) # 2 digit ndc

country '973', none >> split(4,4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en

Expand Down
16 changes: 9 additions & 7 deletions spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,16 @@ def self.it_splits number, expected
end

describe 'Israel (972)' do
it_splits '972100', ['972', '1', '00'] # Police
it_splits '97221231234', ['972', '2', '123', '1234'] # Jerusalem Area
it_splits '97282411234', ['972', '8', '241', '1234'] # Gaza Strip (Palestine)
it_splits '97291231234', ['972', '9', '123', '1234'] # Sharon Area
it_splits '972501231234', ['972', '50', '123', '1234'] # Mobile (Pelephone)
it_splits '972591231234', ['972', '59', '123', '1234'] # Mobile Jawwal (Palestine)
it_splits '972771231234', ['972', '77', '123', '1234'] # Cable Phone Services
it_splits '972100', ['972', '1', '00'] # Police
it_splits '97221231234', ['972', '2', '123', '1234'] # Jerusalem Area
it_splits '97282411234', ['972', '8', '241', '1234'] # Gaza Strip (Palestine)
it_splits '97291231234', ['972', '9', '123', '1234'] # Sharon Area
it_splits '972501231234', ['972', '50', '123', '1234'] # Mobile (Pelephone)
it_splits '972591231234', ['972', '59', '123', '1234'] # Mobile Jawwal (Palestine)
it_splits '972771231234', ['972', '77', '123', '1234'] # Cable Phone Services
it_splits '9721700123123', ['972', '1', '700', '123', '123'] # Cable Phone Services
it_splits '972511234567', ['972', '51', '123', '4567'] # Mobile (We4G)
it_splits '972791111111', ['972', '79', '111', '1111'] # Landline (Hallo, Cellact, Telzar)
end
describe 'Israel (970)' do
it_splits '97021231234', ['970', '2', '123', '1234'] # Jerusalem Area
Expand Down

0 comments on commit 29998d2

Please sign in to comment.