Class: Faker::Npi
- Inherits:
-
Object
- Object
- Faker::Npi
- Defined in:
- lib/faker_npi.rb
Class Method Summary collapse
Class Method Details
.check_digits?(num) ⇒ Boolean
12 13 14 15 16 17 18 |
# File 'lib/faker_npi.rb', line 12 def check_digits? num odd = false num.to_s.gsub(/\D/,'').reverse.split('').map(&:to_i).collect { |d| d *= 2 if odd = !odd d > 9 ? d - 9 : d }.sum % 10 == 0 end |
.npi ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/faker_npi.rb', line 4 def npi x = [] 10.times do x << rand(10) end x.join end |