Class: TablePal::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table:, formatter: nil, heading: false, subheading: false, section_end: false, justification: nil, colour: nil) ⇒ Row

Returns a new instance of Row.



6
7
8
9
10
11
12
13
14
# 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

Instance Attribute Details

#colourObject (readonly)

Returns the value of attribute colour.



4
5
6
# File 'lib/row.rb', line 4

def colour
  @colour
end

#formatterObject (readonly)

Returns the value of attribute formatter.



4
5
6
# File 'lib/row.rb', line 4

def formatter
  @formatter
end

#headingObject (readonly)

Returns the value of attribute heading.



4
5
6
# File 'lib/row.rb', line 4

def heading
  @heading
end

#justificationObject (readonly)

Returns the value of attribute justification.



4
5
6
# File 'lib/row.rb', line 4

def justification
  @justification
end

#section_endObject (readonly)

Returns the value of attribute section_end.



4
5
6
# File 'lib/row.rb', line 4

def section_end
  @section_end
end

#subheadingObject (readonly)

Returns the value of attribute subheading.



4
5
6
# File 'lib/row.rb', line 4

def subheading
  @subheading
end

#tableObject (readonly)

Returns the value of attribute table.



4
5
6
# File 'lib/row.rb', line 4

def table
  @table
end

Instance Method Details

#cells_including_emptyObject



16
17
18
19
20
# File 'lib/row.rb', line 16

def cells_including_empty
  table.columns.map do |column|
    find_cell(column) || create_cell(column)
  end
end

#empty_cellsObject



28
29
30
31
32
# File 'lib/row.rb', line 28

def empty_cells
  table.columns.map do |column|
    table.create_cell(row: self, column: column)
  end
end

#underline_cellsObject



22
23
24
25
26
# 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