From 40ef74d74d59fb1758f820ee24dc5d51f8e32d74 Mon Sep 17 00:00:00 2001 From: Ctalk3r <40827175+Ctalk3r@users.noreply.github.com> Date: Wed, 11 Jul 2018 18:05:04 +0300 Subject: [PATCH] Update triangle.rb --- 2253/1/triangle.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/2253/1/triangle.rb b/2253/1/triangle.rb index 3bcd01b2d..70d633445 100644 --- a/2253/1/triangle.rb +++ b/2253/1/triangle.rb @@ -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