module TablePal class Table attr_reader :rows, :columns, :cells def initialize @rows = [] @columns = [] @cells = [] end def create_row(options = {}) Row.new(options.merge(table: self)).tap do |row| @rows << row end end def create_underline Row.new(table: self).cells_as_underline end def create_column(options = {}) Column.new(options.merge(table: self)).tap do |column| @columns << column end end def create_cell(options = {}) Cell.new(options).tap do |cell| @cells << cell end end def find_cell(row:, column:) cells.find { |cell| cell.row == row && cell.column == column } end def select_cells(column:) cells.select { |cell| cell.column == column } end end end