Sha256: 53968ddcdb7051a3d43e145bb83aba188160e24bc00ea9952ebd33e4e4de437f

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8

module  Faker
  # Author: guapolo github.com/guapolo
  module PhoneNumberMX
    extend ModuleUtils
    extend self

    # Generates a general phone number
    #  xx xxxx xxxx
    #
    def home_work_phone_number
      Faker.numerify("## #### ####")
    end

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

    # generates mobile or home/work number
    def phone_number
      case rand(2)
      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
      Faker.numerify("#{country_code} 1 ## #### ####")
    end

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

    def international_phone_number
      case rand(2)
      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
      Faker.numerify("01 800 ### ####")
    end

  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/phone_number_mx.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/phone_number_mx.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/phone_number_mx.rb
ffaker-1.32.1 lib/ffaker/phone_number_mx.rb
ffaker-1.32.0 lib/ffaker/phone_number_mx.rb
ffaker-1.31.0 lib/ffaker/phone_number_mx.rb
ffaker-1.30.0 lib/ffaker/phone_number_mx.rb
ffaker-1.25.0 lib/ffaker/phone_number_mx.rb
ffaker-1.24.0 lib/ffaker/phone_number_mx.rb
ffakerer-1.0.2 lib/ffakerer/phone_number_mx.rb
ffaker-1.23.0 lib/ffaker/phone_number_mx.rb
ffakerer-1.0.1 lib/ffakerer/phone_number_mx.rb
ffaker-1.22.1 lib/ffaker/phone_number_mx.rb
ffaker-1.22.0 lib/ffaker/phone_number_mx.rb