Module: Faker::PhoneNumberMX

Extended by:
ModuleUtils, PhoneNumberMX
Included in:
PhoneNumberMX
Defined in:
lib/ffakerer/phone_number_mx.rb

Overview

Author: guapolo github.com/guapolo

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Instance Method Details

#country_codeObject



31
32
33
# File 'lib/ffakerer/phone_number_mx.rb', line 31

def country_code
  "+52"
end

#home_work_phone_numberObject

Generates a general phone number

xx xxxx xxxx


12
13
14
# File 'lib/ffakerer/phone_number_mx.rb', line 12

def home_work_phone_number
  Faker.numerify("## #### ####")
end

#international_home_work_phone_numberObject



39
40
41
# File 'lib/ffakerer/phone_number_mx.rb', line 39

def international_home_work_phone_number
  Faker.numerify("#{country_code} ## #### ####")
end

#international_mobile_phone_numberObject



35
36
37
# File 'lib/ffakerer/phone_number_mx.rb', line 35

def international_mobile_phone_number
  Faker.numerify("#{country_code} 1 ## #### ####")
end

#international_phone_numberObject



43
44
45
46
47
48
# File 'lib/ffakerer/phone_number_mx.rb', line 43

def international_phone_number
  case rand(2)
  when 0 then international_mobile_phone_number
  when 1 then international_home_work_phone_number
  end
end

#mobile_phone_numberObject

Generates a mobile phone number 044 xx xxxx xxxx



19
20
21
# File 'lib/ffakerer/phone_number_mx.rb', line 19

def mobile_phone_number
  Faker.numerify("044 ## #### ####")
end

#phone_numberObject

generates mobile or home/work number



24
25
26
27
28
29
# File 'lib/ffakerer/phone_number_mx.rb', line 24

def phone_number
  case rand(2)
  when 0 then home_work_phone_number
  when 1 then mobile_phone_number
  end
end

#toll_free_numberObject

Generates a toll-free number

01 800 xxx xxxx


53
54
55
# File 'lib/ffakerer/phone_number_mx.rb', line 53

def toll_free_number
  Faker.numerify("01 800 ### ####")
end