Commit 71ef614
Changed files (2)
lib/turn_left.rb
@@ -3,9 +3,7 @@ class TurnLeft
@rover = rover
end
def run(instruction)
- if matches(instruction)
- @rover.rotate(-90)
- end
+ @rover.rotate(-90) if matches(instruction)
end
def matches(item)
'L' == item
lib/turn_right.rb
@@ -3,9 +3,7 @@ class TurnRight
@rover = rover
end
def run(instruction)
- if matches(instruction)
- @rover.rotate(90)
- end
+ @rover.rotate(90) if matches(instruction)
end
def matches(item)
'R' == item