Class: Synthra::Types::AddressLocation::HospitalState

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

Overview

HospitalState type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



172
173
174
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 172

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

#generate_invalid(rng, context, args) ⇒ Object



176
177
178
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 176

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

#generate_random(rng, context, args) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 158

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

  else
    Faker::Address.state
  end

rescue StandardError
  rng.sample(["California", "New York", "Texas"])
end