class RealTalk
Constants
- EXCITED_TALK
- HAPPY_TALK
- MAD_TALK
- SAD_TALK
- STRESSED_TALK
Attributes
feelings[R]
reason_for_feelings[R]
Public Instance Methods
real_talk()
click to toggle source
# File lib/real_talk.rb, line 63 def real_talk puts "Welcome to Real Talk!" welcome_message while !valid_user_input? print_bad_input_message welcome_message end ask_question response end
Private Instance Methods
ask_question()
click to toggle source
# File lib/real_talk.rb, line 95 def ask_question puts "\nWhat's making you feel that way? " @reason_for_feelings = gets.chomp end
print_bad_input_message()
click to toggle source
# File lib/real_talk.rb, line 91 def print_bad_input_message puts "Sorry, #{feelings} is not a valid emotion. " end
response()
click to toggle source
# File lib/real_talk.rb, line 100 def response if feelings == 'happy' puts "\n" + HAPPY_TALK.sample elsif feelings == 'sad' puts "\n" + SAD_TALK.sample elsif feelings == 'stressed' puts "\n" + STRESSED_TALK.sample elsif feelings == 'mad' puts "\n" + MAD_TALK.sample else puts "\n" + EXCITED_TALK.sample end end
valid_user_input?()
click to toggle source
# File lib/real_talk.rb, line 83 def valid_user_input? feelings == 'happy' || feelings == 'sad' || feelings == 'stressed' || feelings == 'mad' || feelings == 'excited' end
welcome_message()
click to toggle source
# File lib/real_talk.rb, line 77 def welcome_message puts "\nHow are you feeling today?" puts "HAPPY / SAD / STRESSED / MAD / EXCITED" @feelings = gets.chomp.downcase.strip end