Sha256: e6bd71407ed55730f182e29afef5b88409c0a2e971208e99743c315ccc5f5087
Contents?: true
Size: 684 Bytes
Versions: 2
Compression:
Stored size: 684 Bytes
Contents
module Faker module Medical class DEA < Base class << self def dea(type = 'A', last_name = 'Smith') prefix = type + last_name[0] suffix = numerify('######') "#{prefix}#{suffix}#{check_digit(suffix)}" end private def check_digit(dea_suffix_number) n_array = dea_suffix_number.split('') first_number = n_array[0].to_i + n_array[2].to_i + n_array[4].to_i sec_number = n_array[1].to_i + n_array[3].to_i + n_array[5].to_i sec_number *= 2 check_digit = first_number + sec_number check_digit.to_s.split('').last end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
faker-medical-0.5.2 | lib/faker/medical/dea.rb |
faker-medical-0.5.1 | lib/faker/medical/dea.rb |