Class: Synthra::Types::AddressLocation::HospitalCity

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

Overview

HospitalCity type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



122
123
124
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 122

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

#generate_invalid(rng, context, args) ⇒ Object



126
127
128
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 126

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

#generate_random(rng, context, args) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 108

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