Created
September 14, 2010 04:50
-
-
Save madpilot/578562 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 SmokeyTheBear | |
def method_missing(symbol, *args) | |
responses = [ :me, :you ] | |
if responses.include?(symbol) | |
what_was_said = symbol.to_s | |
what_was_meant = responses.dup.delete_if { |r| r == symbol }.first.to_s | |
return "You chose '#{what_was_said}' referring to '#{what_was_meant}'. That is incorrect. The correct answer is '#{what_was_meant}'." | |
else | |
super | |
end | |
end | |
end | |
bear = SmokeyTheBear.new | |
puts bear.you | |
puts bear.me | |
puts bear.maggie |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment