1 # Triangle Project Code.
3 # Triangle analyzes the lengths of the sides of a triangle
4 # (represented by a, b and c) and returns the type of triangle.
7 # :equilateral if all sides are equal
8 # :isosceles if exactly 2 sides are equal
9 # :scalene if no sides are equal
11 # The tests for this method can be found in
12 # about_triangle_project.rb
14 # about_triangle_project_2.rb
19 a, b, c = [a, b, c].sort
20 fail TriangleError if (a+b) <= c
21 sides = [a, b, c].uniq
22 [nil, :equilateral, :isosceles, :scalene][sides.size]
26 # Error class used in part 2. No need to change this code.
27 class TriangleError < StandardError