Class: Synthra::Types::AddressLocation::AirportMunicipality

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

Overview

AirportMunicipality type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



165
166
167
# File 'lib/synthra/types/address_location/airports.rb', line 165

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

#generate_invalid(rng, context, args) ⇒ Object



169
170
171
# File 'lib/synthra/types/address_location/airports.rb', line 169

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

#generate_random(rng, context, args) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/synthra/types/address_location/airports.rb', line 151

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

  else
    Faker::Address.city
  end

rescue StandardError
  rng.sample(["New York", "Los Angeles", "Chicago"])
end