Class: TablePal::Row
- Inherits:
-
Object
- Object
- TablePal::Row
- Defined in:
- lib/row.rb
Instance Attribute Summary collapse
-
#colour ⇒ Object
readonly
Returns the value of attribute colour.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#heading ⇒ Object
readonly
Returns the value of attribute heading.
-
#justification ⇒ Object
readonly
Returns the value of attribute justification.
-
#section_end ⇒ Object
readonly
Returns the value of attribute section_end.
-
#subheading ⇒ Object
readonly
Returns the value of attribute subheading.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #cells_including_empty ⇒ Object
- #empty_cells ⇒ Object
-
#initialize(table:, formatter: nil, heading: false, subheading: false, section_end: false, justification: nil, colour: nil) ⇒ Row
constructor
A new instance of Row.
- #underline_cells ⇒ Object
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
#colour ⇒ Object (readonly)
Returns the value of attribute colour.
4 5 6 |
# File 'lib/row.rb', line 4 def colour @colour end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
4 5 6 |
# File 'lib/row.rb', line 4 def formatter @formatter end |
#heading ⇒ Object (readonly)
Returns the value of attribute heading.
4 5 6 |
# File 'lib/row.rb', line 4 def heading @heading end |
#justification ⇒ Object (readonly)
Returns the value of attribute justification.
4 5 6 |
# File 'lib/row.rb', line 4 def justification @justification end |
#section_end ⇒ Object (readonly)
Returns the value of attribute section_end.
4 5 6 |
# File 'lib/row.rb', line 4 def section_end @section_end end |
#subheading ⇒ Object (readonly)
Returns the value of attribute subheading.
4 5 6 |
# File 'lib/row.rb', line 4 def subheading @subheading end |
#table ⇒ Object (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_empty ⇒ Object
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_cells ⇒ Object
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_cells ⇒ Object
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 |