Created
January 28, 2012 15:33
-
-
Save pbjorklund/1694712 to your computer and use it in GitHub Desktop.
Fun with ruby koans triangle class
This file contains hidden or 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 triangle(*args) | |
| [:equilateral, :isosceles, :scalene][args[0..2].uniq.size-1] | |
| end | |
| def triangle(a,b,c) | |
| [:equilateral, :isosceles, :scalene].fetch([a,b,c].uniq.size - 1) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment