Skip to content

Instantly share code, notes, and snippets.

Created September 4, 2009 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/180794 to your computer and use it in GitHub Desktop.
Save anonymous/180794 to your computer and use it in GitHub Desktop.
def do_something
action = case self
when self.play?: true ? 'play football' : 'do nothing'
when self.work?: 'go to work'
when self.sleep?: 'sleep'
else: 'What?'
end
return action
end
def play?; false; end
def work?; true; end
def sleep?; false; end
object.do_something --> "What?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment