Class: Synthra::Types::FinanceBanking::NhsNumber

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/finance_banking/identifiers.rb

Overview

NhsNumber type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



50
51
52
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 50

def generate_edge(rng, context, args)
  ["0000000000", "9999999999", "1234567890"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



54
55
56
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 54

def generate_invalid(rng, context, args)
  [nil, "not a nhs", [], {}, "123456789"].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



45
46
47
48
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 45

def generate_random(rng, context, args)
  # NHS numbers are 10 digits
  format("%010d", rng.int(1000000000, 9999999999))
end