Class: Synthra::Types::TechnologyInternet::Domain
- Defined in:
- lib/synthra/types/technology_internet/communication.rb
Overview
Domain type
Instance Method Summary collapse
- #generate_edge(rng, context, args) ⇒ Object
- #generate_invalid(rng, context, args) ⇒ Object
-
#generate_random(rng, context, args) ⇒ String
Generate random domain name.
Instance Method Details
#generate_edge(rng, context, args) ⇒ Object
116 117 118 |
# File 'lib/synthra/types/technology_internet/communication.rb', line 116 def generate_edge(rng, context, args) ["", "a.b", "very-long-domain-name-that-exceeds-normal-limits.com"].sample(random: rng.instance_variable_get(:@random)) end |
#generate_invalid(rng, context, args) ⇒ Object
120 121 122 |
# File 'lib/synthra/types/technology_internet/communication.rb', line 120 def generate_invalid(rng, context, args) [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random)) end |
#generate_random(rng, context, args) ⇒ String
Generate random domain name
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/synthra/types/technology_internet/communication.rb', line 102 def generate_random(rng, context, args) adapter = faker_adapter(context) if adapter adapter.domain_name else Faker::Internet.domain_name end rescue StandardError "#{rng.sample(['example', 'test', 'demo'])}.#{rng.sample(['com', 'org', 'net'])}" end |