Class: Synthra::Types::AddressLocation::AirportRegionCode

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

Overview

AirportRegionCode type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



190
191
192
# File 'lib/synthra/types/address_location/airports.rb', line 190

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

#generate_invalid(rng, context, args) ⇒ Object



194
195
196
# File 'lib/synthra/types/address_location/airports.rb', line 194

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

#generate_random(rng, context, args) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/synthra/types/address_location/airports.rb', line 176

def generate_random(rng, context, args)
  adapter = faker_adapter(context)
  if adapter && adapter.respond_to?(:state)
    adapter.state

  else
    rng.sample(["CA", "NY", "TX", "FL", "IL"])
  end

rescue StandardError
  rng.sample(["CA", "NY", "TX", "FL", "IL"])
end