Skip to content

Instantly share code, notes, and snippets.

@pbjorklund
Created January 28, 2012 15:33
Show Gist options
  • Save pbjorklund/1694712 to your computer and use it in GitHub Desktop.
Save pbjorklund/1694712 to your computer and use it in GitHub Desktop.
Fun with ruby koans triangle class
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