Last active
September 22, 2018 16:47
-
-
Save glv/e6076d56b714d5fce2da266558aa8011 to your computer and use it in GitHub Desktop.
Using Ruby's "case" without a matching object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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