Class: Synthra::Types::AddressLocation::BankState

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

Overview

BankState type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



97
98
99
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 97

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

#generate_invalid(rng, context, args) ⇒ Object



101
102
103
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 101

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

#generate_random(rng, context, args) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/synthra/types/address_location/banks_hospitals.rb', line 83

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