Skip to content

Instantly share code, notes, and snippets.

@pjb3
Forked from jackdempsey/gist:327546
Created March 10, 2010 13:50
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 pjb3/327879 to your computer and use it in GitHub Desktop.
Save pjb3/327879 to your computer and use it in GitHub Desktop.
# best way to code: if event is nil, true, otherwise if event.user == user true, else false
# seems clear but is so vertically long for such a simple thing
if event
event.user == user
else
true
end
# nice and compact but wtf does it mean
event.nil? || event.user == user
# winner winner?
(event && event.user == user) || true
# other thoughts? fork away
event ? event.user == user : true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment