Module: Dummy::PhoneNumber

Extended by:
PhoneNumber
Included in:
PhoneNumber
Defined in:
lib/dummy/phone_number.rb

Instance Method Summary collapse

Instance Method Details

#phone_numberObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dummy/phone_number.rb', line 5

def phone_number
  format = case rand(20)
  when      0 then "###-###-#### x#####"
  when      1 then "###-###-#### x####"
  when      2 then "###-###-#### x###"
  when   3..4 then "###-###-####"
  when      5 then "###.###.#### x#####"
  when      6 then "###.###.#### x####"
  when      7 then "###.###.#### x###"
  when   8..9 then "###.###.####"
  when     10 then "(###)###-#### x#####"
  when     11 then "(###)###-#### x####"
  when     12 then "(###)###-#### x###"
  when 13..14 then "(###)###-####"
  when     15 then "1-###-###-#### x#####"
  when     16 then "1-###-###-#### x####"
  when     17 then "1-###-###-#### x###"
  when 18..19 then "1-###-###-####"
  end
  
  format.numerify
end

#phone_number_shortObject



28
29
30
# File 'lib/dummy/phone_number.rb', line 28

def phone_number_short
  "###-###-####".numerify
end