Class: Synthra::Types::TextContent::CatchPhrase

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

Overview

CatchPhrase type

Constant Summary collapse

PHRASES =
[
  "Think Different", "Just Do It", "I'm Lovin' It",
  "Because You're Worth It", "The Best a Man Can Get"
].freeze

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



57
58
59
# File 'lib/synthra/types/text_content/business.rb', line 57

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

#generate_invalid(rng, context, args) ⇒ Object



61
62
63
# File 'lib/synthra/types/text_content/business.rb', line 61

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

#generate_random(rng, context, args) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/synthra/types/text_content/business.rb', line 43

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

  else
    Faker::Company.catch_phrase
  end

rescue StandardError
  rng.sample(PHRASES)
end