class Asciidoctor::Table::Rows

Public: A data object that encapsulates the collection of rows (head, foot, body) for a table

Attributes

body[RW]
foot[RW]
head[RW]

Public Class Methods

new(head = [], foot = [], body = []) click to toggle source
# File lib/asciidoctor/table.rb, line 13
def initialize head = [], foot = [], body = []
  @head = head
  @foot = foot
  @body = body
end

Public Instance Methods

by_section() click to toggle source

Public: Retrieve the rows grouped by section as a nested Array.

Creates a 2-dimensional array of two element entries. The first element is the section name as a symbol. The second element is the Array of rows in that section. The entries are in document order (head, foot, body).

Returns a 2-dimentional Array of rows grouped by section.

# File lib/asciidoctor/table.rb, line 28
def by_section
  [[:head, @head], [:body, @body], [:foot, @foot]]
end
to_h() click to toggle source

Public: Retrieve the rows as a Hash.

The keys are the names of the section groups and the values are the Array of rows in that section. The keys are in document order (head, foot, body).

Returns a Hash of rows grouped by section.

# File lib/asciidoctor/table.rb, line 38
def to_h
  { head: @head, body: @body, foot: @foot }
end