Checking for a win in TicTacToe
When all of your code is the same, just with different numbers, you want to use data-directed programming.

WINS = [
  [0, 1, 2], [3, 4, 5], [6, 7, 8],  # &lt;-- Horizontal wins
  [0, 3, 6], [1, 4, 7], [2, 5, 8],  # &lt;-- Vertical wins
  [0, 4, 8], [2, 4, 6],             # &lt;-- Diagonal wins
]

def check_lines
  if WINS.any? { |line| line.all? { |square| @squares[square] == @player } }
    @win = @player
  end
end