Sha256: 30b573a7b924d3adad513b933c3b313b8a993f26e438ea41bc7b0d3c01ada6dc

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

module FFakerTW
  module PhoneNumberID
    extend ModuleUtils
    extend self

    COUNTRY_CODE = '+62'

    def mobile_phone_number
      "#{fetch_sample(MOBILE_PHONE_PREFIXES)}-#{FFakerTW.numerify('########')}"
    end

    def home_phone_number
      digit_nums = '#' * rand(7..8)

      "#{fetch_sample(HOME_PHONE_PREFIXES)}-#{FFakerTW.numerify(digit_nums)}"
    end

    def phone_number
      rand(0..1).zero? ? home_phone_number : mobile_phone_number
    end

    def international_mobile_phone_number
      mobile_phone_number.sub('0', COUNTRY_CODE)
    end

    def international_home_phone_number
      home_phone_number.sub('0', COUNTRY_CODE)
    end

    def international_phone_number
      phone_number.sub('0', COUNTRY_CODE)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffakerTW-0.1.0 lib/ffakerTW/phone_number_id.rb