class Paru::PandocFilter::Row

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

@!attribute attr

@return Attr

@!attribute cells

@return [Block]

Attributes

attr[RW]

Public Class Methods

new(contents = []) click to toggle source

Create a new Row based on the row_data

@param contents [Array = []] the contents of

this Row node
Calls superclass method
# File lib/paru/filter/row.rb, line 39
def initialize(contents = [])
    @attr = Attr.new contents[0]
    super []
    contents[1].each do |cell|
        @children.push Cell.new cell
    end
end

Public Instance Methods

ast_contents() click to toggle source

The AST contents of this Row

@return [Array]

# File lib/paru/filter/row.rb, line 57
def ast_contents
    [
      @attr.to_ast,
      @children.map {|child| child.to_ast}
    ]
end
cells() click to toggle source

The cells of this row

@return [Array<Cell>]

# File lib/paru/filter/row.rb, line 50
def cells()
  @children
end
to_array() click to toggle source

Convert this Row to an array of markdown strings, one for each cell

@return [String An Array representation of this Row.

# File lib/paru/filter/row.rb, line 75
def to_array()
    @children.map do |cell|
        cell.children.map{|c| c.markdown.strip}.join("\n")
    end
end
to_ast() click to toggle source

Create an AST representation of this Node

@return [Hash]

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