Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Update triangle.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Ctalk3r committed Jul 11, 2018
1 parent 0771e28 commit 03d4cdb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions 2253/1/triangle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
# :scalene if no sides are equal
#
def triangle(fir, sec, thi)
raise TriangleError
if [fir, sec, thi].min <= 0 || fir + sec <= thi || fir + thi <= sec || sec + thi <= fir
[:equilateral, :isosceles, :scalene].fetch([fir, sec, thi].uniq.size - 1)
raise TriangleError if [fir, sec, thi].min <= 0 || fir + sec <= thi || fir + thi <= sec || sec + thi <= fir
%i[equilateral isosceles scalene].fetch([fir, sec, thi].uniq.size - 1)
end

# Error class used in part 2. No need to change this code.
# rubocop:disable Lint/Syntax
class TriangleError < StandardError
end
# rubocop:enable Lint/Syntax

0 comments on commit 03d4cdb

Please sign in to comment.