Skip to content

Instantly share code, notes, and snippets.

@teamon
Last active August 29, 2015 14:01
Show Gist options
  • Save teamon/6c82cf686291e61bc2fc to your computer and use it in GitHub Desktop.
Save teamon/6c82cf686291e61bc2fc to your computer and use it in GitHub Desktop.
Ruby 2.1 method return value use cases
private def foo # make one method private
instrumet def foo # calculates execution time
silent def foo # silences stdout/err output
cached def foo(args...) # caches each invokation with different arguments into redis
memoize def foo # memoizes return value in instance variable
async def foo # executes method in new thread and return thread object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment