Maybe something like this?
def move_forward(unit = 1)
x, y, d = x_coordinate, y_coordinate, direction
case d
when Direction::SOUTH
place(x, y - unit, d)
when Direction::EAST, Direction::WEST
place(x + unit, y, d)
when Direction::NORTH
place(x, y + unit, d)
else
end
end
I find the complaints about the "duplicate calls" to self.x_coordindate
and self.y_coordinate
kinda false-positivey though, they're only called once per path.