module TablePal class Column attr_reader :table, :left_padding, :right_padding, :left_border, :right_border, :justification, :colour def initialize(table:, left_padding: ' ', right_padding: ' ', left_border: '', right_border: '|', justification: :left, colour: nil) @table = table @left_padding = left_padding @right_padding = right_padding @left_border = left_border @right_border = right_border @justification = justification @colour = colour end def width table.select_cells(column: self).max_by(&:width).width end def left_padding_char(char) char * left_padding.length end def right_padding_char(char) char * right_padding.length end end end