Class: Synthra::Types::TextContent::Slogan

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/text_content/business.rb

Overview

Slogan type

Constant Summary collapse

SLOGANS =
[
  "Just Do It", "Think Different", "I'm Lovin' It",
  "Because You're Worth It", "The Best a Man Can Get",
  "Have It Your Way", "Finger Lickin' Good"
].freeze

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



93
94
95
# File 'lib/synthra/types/text_content/business.rb', line 93

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

#generate_invalid(rng, context, args) ⇒ Object



97
98
99
# File 'lib/synthra/types/text_content/business.rb', line 97

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

#generate_random(rng, context, args) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/synthra/types/text_content/business.rb', line 74

def generate_random(rng, context, args)
  adapter = faker_adapter(context)
  if adapter && adapter.respond_to?(:slogan)
    begin
      adapter.slogan
    rescue StandardError
      rng.sample(SLOGANS)
    end
  else
    # Faker doesn't have a direct slogan method, use catch_phrase
    begin
      Faker::Company.catch_phrase
    rescue StandardError
      # Fallback to English-only hardcoded list
      rng.sample(SLOGANS) # fallback
    end
  end
end