Cleaning up a class that contains the object it represents I've recently started writing a tic-tac-toe game (following the Odin project) and am trying to write a class to hold the board game.

What I'm not sure about, is that the board class holds all the data related to the board in a variable called @board. Now after thinking about it I decided that the Board class shouldn't know about the game logic, and just hold the board itself, but now I'm not sure if it's redundant or not.

Main problem is that right now, when I try to add logic to the Game class, I get a function that looks like this:

class Game
  .
  def is_over?
    board = @board.board
    .
    .
  end
end


Which just feels wrong...
my current implementation for it is like so:  

module TicTacToe
  class Board
    attr_reader :board
    def initialize(size)
      @board = create_empty_board(size)
      @size = size
    end

    def print_board
      @size.times { print "-----" }
      puts
      @board.each do |row|
        row.each do |c|
          print "| #{c} |"
        end
      puts
      @size.times { print "-----" }
      puts
      end
    end

    def make_move(move, sym)
      if board[x][y] == ' '
        board[x][y] = sym
      else
        raise ArgumentError, "Invalid, cell not empty"
      end
    end

  private
    def create_empty_board(size)
      board = Array.new
      size.times do
        row = Array.new
        size.times do
          row &lt;&lt; ' '
        end
        board &lt;&lt; row
      end
      board
    end
  end
end
Yes, your board.board has a code smell, but it is hard to say what to do without knowing Game.

Actually Board#board is an array. I would recommend to add methods to Board that allow you to use the instance of Board instead of Board#board.

Example: To get a row of yor board you can use: 

class Board
  ...
  def [](row) #Access to one row
    @board[row]
  end
  def each_row #loop on all rows...
    @board.each{|row| yield row }
  end

end

class Game
  ...
  def is_over?
    @board.each_row{|row|
     row.each{|field| } ##your check
    }
    ...
  end
end