Class: Synthra::Types::AddressLocation::AirportGpsCode
- Defined in:
- lib/synthra/types/address_location/airports.rb
Overview
AirportGpsCode type
Instance Method Summary collapse
- #generate_edge(rng, context, args) ⇒ Object
- #generate_invalid(rng, context, args) ⇒ Object
- #generate_random(rng, context, args) ⇒ Object
Instance Method Details
#generate_edge(rng, context, args) ⇒ Object
108 109 110 |
# File 'lib/synthra/types/address_location/airports.rb', line 108 def generate_edge(rng, context, args) ["", "A", "ABCDEF"].sample(random: rng.instance_variable_get(:@random)) end |
#generate_invalid(rng, context, args) ⇒ Object
112 113 114 |
# File 'lib/synthra/types/address_location/airports.rb', line 112 def generate_invalid(rng, context, args) [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random)) end |
#generate_random(rng, context, args) ⇒ Object
101 102 103 104 105 106 |
# File 'lib/synthra/types/address_location/airports.rb', line 101 def generate_random(rng, context, args) # GPS codes are typically 4-6 alphanumeric characters chars = ('A'..'Z').to_a + ('0'..'9').to_a length = rng.int(4, 6) length.times.map { rng.sample(chars) }.join end |