class Paru::PandocFilter::TableBody

A TableBody node represents a row in a table’s head or body

@!attribute attr

@return Attr

@!attribute rowheadcolumns

@return Value containing an Integer indicating the number of head
columns.

@!attribute rowheadercolums

@return [Row]

@!attribute rows

@return [Row]

Attributes

attr[RW]
rowheadcolumnspec[RW]
rowheadercolumns[RW]

Public Class Methods

new(contents) click to toggle source

Create a new TableBody

@param contents [Array] The contents of this TableBody

Calls superclass method
# File lib/paru/filter/table_body.rb, line 45
def initialize(contents)
    @attr = Attr.new contents[0]
    @rowheadcolumns = IntValue.new contents[1]
    @rowheadercolumns = contents[2].map {|r| Row.new r}

    super []
    contents[3].each do |row|
        @children.push Row.new row
    end
end

Public Instance Methods

ast_contents() click to toggle source

The AST contents of this TableBody

@return [Array]

# File lib/paru/filter/table_body.rb, line 66
def ast_contents
    [
      @attr.to_ast,
      @rowheadcolumns.to_ast,
      @rowheadercolumns.map {|r| r.to_ast},
      @children.map {|child| child.to_ast}
    ]
end
rows() click to toggle source

The rows in this TableBody

@return [Array<Row>]

# File lib/paru/filter/table_body.rb, line 59
def rows()
    @children
end
to_array() click to toggle source

Convert this table end to a 2D table of markdown strings for each cell

@return [String[]] This Table as a 2D array of cells represented by their markdown strings.

# File lib/paru/filter/table_body.rb, line 87
def to_array()
    @children.map do |row|
        row.to_array
    end
end
to_ast() click to toggle source

Create an AST representation of this Node

@return [Hash]

# File lib/paru/filter/table_body.rb, line 78
def to_ast()
  ast_contents()
end