Class: Synthra::Types::FinanceBanking::Ein

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

Overview

Ein type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



34
35
36
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 34

def generate_edge(rng, context, args)
  ["00-0000000", "99-9999999", "12-3456789"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



38
39
40
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 38

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

#generate_random(rng, context, args) ⇒ Object



27
28
29
30
31
32
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 27

def generate_random(rng, context, args)
  # Format: XX-XXXXXXX
  part1 = format("%02d", rng.int(10, 99))
  part2 = format("%07d", rng.int(1000000, 9999999))
  "#{part1}-#{part2}"
end