Skip to content

Instantly share code, notes, and snippets.

@glv
Last active September 22, 2018 16:47
Show Gist options
  • Save glv/e6076d56b714d5fce2da266558aa8011 to your computer and use it in GitHub Desktop.
Save glv/e6076d56b714d5fce2da266558aa8011 to your computer and use it in GitHub Desktop.
Using Ruby's "case" without a matching object
def preferred_over?(other_name)
case
when partial_name? && !other_name.partial_name?
false
when other_name.partial_name? && !partial_name?
true
else
max_preference >= other_name.max_preference
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment