/usr/share/rubygems-integration/all/gems/faker-1.6.6/lib/faker/phone_number.rb is in ruby-faker 1.6.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | module Faker
class PhoneNumber < Base
class << self
def phone_number
if parse('phone_number.formats') == ""
numerify(fetch('phone_number.formats'))
else
parse('phone_number.formats')
end
end
def cell_phone
if parse('cell_phone.formats') == ""
numerify(fetch('cell_phone.formats'))
else
parse('cell_phone.formats')
end
end
# US only
def area_code
begin
fetch('phone_number.area_code')
rescue I18n::MissingTranslationData
nil
end
end
# US only
def exchange_code
begin
fetch('phone_number.exchange_code')
rescue I18n::MissingTranslationData
nil
end
end
# US 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
def subscriber_number(length = 4)
begin
rand.to_s[2..(1 + length)]
rescue I18n::MissingTranslationData
nil
end
end
alias_method :extension, :subscriber_number
end
end
end
|