Class: Synthra::Types::AddressLocation::City
- Defined in:
- lib/synthra/types/address_location/locations.rb
Overview
City type
Instance Method Summary collapse
- #generate_edge(rng, context, args) ⇒ Object
- #generate_invalid(rng, context, args) ⇒ Object
-
#generate_random(rng, context, args) ⇒ String
Generate random city name.
Instance Method Details
#generate_edge(rng, context, args) ⇒ Object
29 30 31 |
# File 'lib/synthra/types/address_location/locations.rb', line 29 def generate_edge(rng, context, args) ["", "A", "Very Long City Name That Exceeds Normal Limits"].sample(random: rng.instance_variable_get(:@random)) end |
#generate_invalid(rng, context, args) ⇒ Object
33 34 35 |
# File 'lib/synthra/types/address_location/locations.rb', line 33 def generate_invalid(rng, context, args) [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random)) end |
#generate_random(rng, context, args) ⇒ String
Generate random city name
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/synthra/types/address_location/locations.rb', line 15 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", "Houston", "Phoenix"]) end |