Skip to content

Instantly share code, notes, and snippets.

@rmm5t
Last active April 9, 2020 02:06
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