Class: Synthra::Types::TextContent::FakeCompanyName
- Defined in:
- lib/synthra/types/text_content/business.rb
Overview
FakeCompanyName type
Instance Method Summary collapse
- #generate_edge(rng, context, args) ⇒ Object
- #generate_invalid(rng, context, args) ⇒ Object
- #generate_random(rng, context, args) ⇒ Object
Instance Method Details
#generate_edge(rng, context, args) ⇒ Object
118 119 120 |
# File 'lib/synthra/types/text_content/business.rb', line 118 def generate_edge(rng, context, args) ["", "A", "Very Long Company Name"].sample(random: rng.instance_variable_get(:@random)) end |
#generate_invalid(rng, context, args) ⇒ Object
122 123 124 |
# File 'lib/synthra/types/text_content/business.rb', line 122 def generate_invalid(rng, context, args) [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random)) end |
#generate_random(rng, context, args) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/synthra/types/text_content/business.rb', line 104 def generate_random(rng, context, args) adapter = faker_adapter(context) if adapter && adapter.respond_to?(:company_name) adapter.company_name else Faker::Company.name end rescue StandardError rng.sample(["Acme Corp", "Tech Solutions Inc", "Global Industries"]) end |