1
我收到以下錯誤在我的機器人類:Ruby的臭佬質量檢查
Commands tests @robot.placed at least 4 times (RepeatedConditional)
這是有問題的代碼,導致了它:
def move
@robot.move_forward if @robot.placed
end
def left
@robot.left if @robot.placed
end
def right
@robot.right if @robot.placed
end
def report
puts @robot.report_current_position if @robot.placed
end
如何將我們重新組織該避免這個警告?