Class: Synthra::Types::AddressLocation::AirportCountryCode

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

Overview

AirportCountryCode type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



75
76
77
# File 'lib/synthra/types/address_location/airports.rb', line 75

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

#generate_invalid(rng, context, args) ⇒ Object



79
80
81
# File 'lib/synthra/types/address_location/airports.rb', line 79

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

#generate_random(rng, context, args) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/synthra/types/address_location/airports.rb', line 61

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