Skip to content

Instantly share code, notes, and snippets.

@kklimuk
Last active April 8, 2017 21:14
Show Gist options
  • Save kklimuk/e3b2c58aaf0de500403520e86c71ddc9 to your computer and use it in GitHub Desktop.
Save kklimuk/e3b2c58aaf0de500403520e86c71ddc9 to your computer and use it in GitHub Desktop.
def users_with_discounts
@users_with_discounts ||= {}
if @users_with_discounts.has_key?(:return_value)
@users_with_discounts[:return_value]
else
@users_with_discounts[:return_value] = computation_that_returns_nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment