Sha256: 81bb5b0f10945b153aed0608b5021216866969125e19f0d252958c82bb438805

Contents?: true

Size: 1.14 KB

Versions: 12

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module FFaker
  module PhoneNumberMX
    extend ModuleUtils
    extend self

    # Generates a general phone number
    #  xx xxxx xxxx
    #
    def home_work_phone_number
      FFaker.numerify('## #### ####')
    end

    # Generates a mobile phone number
    # 044 xx xxxx xxxx
    #
    def mobile_phone_number
      FFaker.numerify('044 ## #### ####')
    end

    # generates mobile or home/work number
    def phone_number
      case rand(0..1)
      when 0 then home_work_phone_number
      when 1 then mobile_phone_number
      end
    end

    def country_code
      '+52'
    end

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

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

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

    # Generates a toll-free number
    #  01 800 xxx xxxx
    #
    def toll_free_number
      FFaker.numerify('01 800 ### ####')
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ffaker-2.23.0 lib/ffaker/phone_number_mx.rb
ffaker-2.22.0 lib/ffaker/phone_number_mx.rb
ffaker-2.21.0 lib/ffaker/phone_number_mx.rb
ffaker-2.20.0 lib/ffaker/phone_number_mx.rb
ffaker-2.19.0 lib/ffaker/phone_number_mx.rb
ffaker-2.18.0 lib/ffaker/phone_number_mx.rb
ffaker-2.17.0 lib/ffaker/phone_number_mx.rb
ffaker-2.16.0 lib/ffaker/phone_number_mx.rb
ffaker-2.15.0 lib/ffaker/phone_number_mx.rb
ffaker-2.14.0 lib/ffaker/phone_number_mx.rb
ffaker-2.13.0 lib/ffaker/phone_number_mx.rb
ffaker-2.12.0 lib/ffaker/phone_number_mx.rb