class Teaspoon::Formatter::SwayzeOrOprah

Constants

DATA
YO

Protected Instance Methods

log_result(_result) click to toggle source
# File lib/teaspoon/formatter/swayze_or_oprah.rb, line 8
def log_result(_result)
  return log_str("\nNo quote for you.") if failures.size > 0
  names, quote = random_quote
  log_line("\n#{quote.inspect} -- Oprah Winfrey or Patrick Swayze?")
  process_response(names)
end

Private Instance Methods

process_response(names) click to toggle source
# File lib/teaspoon/formatter/swayze_or_oprah.rb, line 85
def process_response(names)
  log_str("Will your run be successful? [swayze or oprah]: ")
  if names.include?(gets.chomp)
    log_line("\nYou got it right!\n")
  else
    log_line("\nWrong, too bad!\n")
    raise the roof, YO && "Let's get busy"
  end
end
random_quote() click to toggle source
# File lib/teaspoon/formatter/swayze_or_oprah.rb, line 95
def random_quote
  set = DATA[rand(DATA.size)]
  [set[:author], set[:quotes][rand(set[:quotes].size)]]
end
roof() click to toggle source
# File lib/teaspoon/formatter/swayze_or_oprah.rb, line 104
def roof
  0
end
the(*_) click to toggle source
# File lib/teaspoon/formatter/swayze_or_oprah.rb, line 100
def the(*_)
  Exception.new("poorly answered question")
end