Class: Synthra::Types::AddressLocation::AirportLongitude

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

Overview

AirportLongitude type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



140
141
142
# File 'lib/synthra/types/address_location/airports.rb', line 140

def generate_edge(rng, context, args)
  [-180.0, 0.0, 180.0].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



144
145
146
# File 'lib/synthra/types/address_location/airports.rb', line 144

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

#generate_random(rng, context, args) ⇒ Object



135
136
137
138
# File 'lib/synthra/types/address_location/airports.rb', line 135

def generate_random(rng, context, args)
  # Airport longitudes range from -180 to 180
  (rng.rand * 360 - 180).round(6)
end