Class: Synthra::Types::AddressLocation::AddressLine2

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

Overview

AddressLine2 type

Constant Summary collapse

ADDRESS_LINE2_PREFIXES =
["Apt", "Suite", "Unit", "Floor", "Room", "Building", "Tower"].freeze
ADDRESS_LINE2_SUFFIXES =
["A", "B", "C", "1", "2", "3", "101", "202", "303"].freeze

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



58
59
60
# File 'lib/synthra/types/address_location/addresses.rb', line 58

def generate_edge(rng, context, args)
  ["", "Apt 0", "Suite 9999", "Unit A"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



62
63
64
# File 'lib/synthra/types/address_location/addresses.rb', line 62

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

#generate_random(rng, context, args) ⇒ Object



52
53
54
55
56
# File 'lib/synthra/types/address_location/addresses.rb', line 52

def generate_random(rng, context, args)
  prefix = rng.sample(ADDRESS_LINE2_PREFIXES)
  suffix = rng.sample(ADDRESS_LINE2_SUFFIXES)
  "#{prefix} #{suffix}"
end