module TablePal class Row attr_reader :table, :formatter, :heading, :subheading, :section_end, :justification, :colour def initialize(table:, formatter: nil, heading: false, subheading: false, section_end: false, justification: nil, colour: nil) @table = table @formatter = formatter @heading = heading @subheading = subheading @section_end = section_end @justification = justification @colour = colour end def cells_including_empty table.columns.map do |column| find_cell(column) || create_cell(column) end end def underline_cells table.columns.map do |column| table.create_cell(row: self, column: column, content: '-' * column.width) end end def empty_cells table.columns.map do |column| table.create_cell(row: self, column: column) end end private def find_cell(column) table.find_cell(row: self, column: column) end def create_cell(column) table.create_cell(row: self, column: column) end end end