class Faker::PhoneNumber
Public Class Methods
area_code()
click to toggle source
US and Canada only
# File lib/faker/phone_number.rb, line 13 def area_code fetch('phone_number.area_code') rescue I18n::MissingTranslationData nil end
cell_phone()
click to toggle source
# File lib/faker/phone_number.rb, line 8 def cell_phone parse('cell_phone.formats') end
exchange_code()
click to toggle source
US and Canada only
# File lib/faker/phone_number.rb, line 20 def exchange_code fetch('phone_number.exchange_code') rescue I18n::MissingTranslationData nil end
phone_number()
click to toggle source
# File lib/faker/phone_number.rb, line 4 def phone_number parse('phone_number.formats') end
subscriber_number(length = 4)
click to toggle source
US and Canada only Can be used for both extensions and last four digits of phone number. Since extensions can be of variable length, this method taks a length parameter
# File lib/faker/phone_number.rb, line 29 def subscriber_number(length = 4) rand.to_s[2..(1 + length)] end
Also aliased as: extension