Module: Prawn::Accessibility::TablePatch::TableInstancePatch Private

Included in:
Table
Defined in:
lib/prawn/accessibility/table.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Prepended onto Table. Flags header cells at construction (so Cell#header? is consistent whether or not the table has been drawn), and wraps drawing in a <Table> structure element when the document is tagged.

Instance Method Summary collapse

Instance Method Details

#drawObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
45
46
47
48
# File 'lib/prawn/accessibility/table.rb', line 42

def draw
  if @pdf.respond_to?(:tagged?) && @pdf.tagged?
    @pdf.structure_container(:Table) { super() }
  else
    super
  end
end

#initialize(*args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
40
# File 'lib/prawn/accessibility/table.rb', line 37

def initialize(*args, &block)
  super
  mark_header_cells
end

#mark_header_cellsvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Marks cells in header rows as header cells for accessibility.



53
54
55
56
57
58
59
60
# File 'lib/prawn/accessibility/table.rb', line 53

def mark_header_cells
  n = number_of_header_rows
  return if n.zero?

  @cells.each do |cell|
    cell.is_header_cell = true if cell.row < n
  end
end