Last active
April 9, 2020 02:06
-
-
Save rmm5t/cf74958eb839b1403ad4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bob | |
def respond_to(input) | |
@input = input.strip | |
return "Fine. Be that way!" if silence? | |
return "Whoa, chill out!" if shouting? | |
return "Sure." if question? | |
"Whatever." | |
end | |
def silence? | |
@input.empty? | |
end | |
def shouting? | |
@input == @input.upcase && @input != @input.downcase | |
end | |
def question? | |
@input.end_with?("?") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment