Skip to content

Instantly share code, notes, and snippets.

@reinh
Forked from anonymous/gist:180794
Created September 4, 2009 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinh/180799 to your computer and use it in GitHub Desktop.
Save reinh/180799 to your computer and use it in GitHub Desktop.
def do_something
action = case
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