Class: Synthra::Types::TechnologyInternet::Phone

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/technology_internet/communication.rb

Overview

Phone type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



59
60
61
# File 'lib/synthra/types/technology_internet/communication.rb', line 59

def generate_edge(rng, context, args)
  ["", "+1-555-000-0000", "000-000-0000"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



63
64
65
# File 'lib/synthra/types/technology_internet/communication.rb', line 63

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

#generate_random(rng, context, args) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/synthra/types/technology_internet/communication.rb', line 45

def generate_random(rng, context, args)
  adapter = faker_adapter(context)
  if adapter
    adapter.phone_number

  else
    Faker::PhoneNumber.phone_number
  end

rescue StandardError
  rng.sample(["+1-555-123-4567", "+44-20-1234-5678", "+33-1-23-45-67-89"])
end