Class: Markbridge::AST::TableCell

Inherits:
Element show all
Defined in:
lib/markbridge/ast/table.rb

Overview

Represents a table cell (td or th).

Examples:

Data cell

cell = AST::TableCell.new
cell << AST::Text.new("data")

Header cell

cell = AST::TableCell.new(header: true)
cell << AST::Text.new("header")

Instance Attribute Summary

Attributes inherited from Element

#children

Instance Method Summary collapse

Methods inherited from Element

#<<

Constructor Details

#initialize(header: false) ⇒ TableCell

Create a new table cell.

Parameters:

  • header (Boolean) (defaults to: false)

    whether this is a header cell (th)



54
55
56
57
# File 'lib/markbridge/ast/table.rb', line 54

def initialize(header: false)
  super()
  @header = header
end

Instance Method Details

#header?Boolean

Check if this is a header cell.

Returns:

  • (Boolean)

    true if this is a header cell



62
63
64
# File 'lib/markbridge/ast/table.rb', line 62

def header?
  @header
end