class TablePal::Row

Attributes

colour[R]
formatter[R]
heading[R]
justification[R]
section_end[R]
subheading[R]
table[R]

Public Class Methods

new(table:, formatter: nil, heading: false, subheading: false, section_end: false, justification: nil, colour: nil) click to toggle source
# File lib/row.rb, line 6
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

Public Instance Methods

cells_including_empty() click to toggle source
# File lib/row.rb, line 16
def cells_including_empty
  table.columns.map do |column|
    find_cell(column) || create_cell(column)
  end
end
empty_cells() click to toggle source
# File lib/row.rb, line 28
def empty_cells
  table.columns.map do |column|
    table.create_cell(row: self, column: column)
  end
end
underline_cells() click to toggle source
# File lib/row.rb, line 22
def underline_cells
  table.columns.map do |column|
    table.create_cell(row: self, column: column, content: '-' * column.width)
  end
end

Private Instance Methods

create_cell(column) click to toggle source
# File lib/row.rb, line 40
def create_cell(column)
  table.create_cell(row: self, column: column)
end
find_cell(column) click to toggle source
# File lib/row.rb, line 36
def find_cell(column)
  table.find_cell(row: self, column: column)
end