Class: Synthra::Types::AddressLocation::BankCountryCode

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/address_location/banks_hospitals.rb

Overview

BankCountryCode type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



47
48
49
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 47

def generate_edge(rng, context, args)
  ["", "US", "XX"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



51
52
53
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 51

def generate_invalid(rng, context, args)
  [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 33

def generate_random(rng, context, args)
  adapter = faker_adapter(context)
  if adapter
    adapter.country_code

  else
    Faker::Address.country_code
  end

rescue StandardError
  rng.sample(["US", "GB", "CA", "AU", "DE"])
end