Skip to content

Instantly share code, notes, and snippets.

@rmm5t
Last active April 9, 2020 02:06
Show Gist options
  • Save rmm5t/cf74958eb839b1403ad4 to your computer and use it in GitHub Desktop.
Save rmm5t/cf74958eb839b1403ad4 to your computer and use it in GitHub Desktop.
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