Skip to content

Instantly share code, notes, and snippets.

@mxcl
Forked from Jonty/this_is_a_bit_more_readable.rb
Created November 24, 2009 05:26
Show Gist options
  • Save mxcl/241661 to your computer and use it in GitHub Desktop.
Save mxcl/241661 to your computer and use it in GitHub Desktop.
# This is more "Ruby", and I agree that I don't necessarily agree with
# all the syntax choices. The else condition isn't required as the
# function returns nil if no other code paths executed. You could argue
# that, that is a regression waiting to happen though.
def just_one_kind_of_response? item, controller
case controller
when 'actions'
item.comments.blank? or item.suggestions.blank? or detail.comments.blank?
when 'thoughts'
item.comments.blank? or item.suggestions.blank?
when 'suggestions'
item.comments.blank? or item.actions.blank?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment