Sha256: 7128e17b44eb719d648ee39af88674405a26ad7aac6bb93e9107836c1c7a71a6

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module FFakerTW
  module PhoneNumberKR
    extend ModuleUtils
    extend self

    HOME_PHONE_PREFIXES =
      %w[02 031 032 033 041 042 043 044 049 051 052 053 054 055 061 062 063 064].freeze
    MOBILE_PHONE_PREFIXES = %w[010 011 016 019].freeze

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

    def home_work_phone_number
      FFakerTW.numerify("#{fetch_sample(HOME_PHONE_PREFIXES)} #### ####")
    end

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

    def contry_code
      '+82'
    end

    def international_mobile_phone_number
      number = mobile_phone_number
      number[0] = "#{contry_code} "
      number
    end

    def international_home_work_phone_number
      number = home_work_phone_number
      number[0] = "#{contry_code} "
      number
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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