Skip to content

Instantly share code, notes, and snippets.

@bruce
Forked from mperham/gist:257316
Created December 15, 2009 21:29
Show Gist options
  • Save bruce/257326 to your computer and use it in GitHub Desktop.
Save bruce/257326 to your computer and use it in GitHub Desktop.
def exists?(attribs)
CustomImage.find_by_account_id_and_hash(attribs['account_id'], attribs['id'])
end
# Memoize using <tt>defined?</tt>
def some_method(attribs)
return @some_method if defined?(@some_method)
@some_method = exists?(attribs)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment