Class: NattyUI::Table::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/natty-ui/helper/table.rb

Overview

A single cell in a NattyUI::Table.

Cells are created implicitly when rows are populated via Row#add, Row#add_text, Row#fill, and similar helpers. Each cell holds #text content and a set of #attributes that control its layout.

Defined Under Namespace

Classes: Attributes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*text, **attributes) ⇒ Cell

Returns a new instance of Cell.

Parameters:



552
553
554
555
# File 'lib/natty-ui/helper/table.rb', line 552

def initialize(*text, **attributes)
  @text = text
  @attributes = Attributes.new(**attributes)
end

Instance Attribute Details

#attributesCell::Attributes (readonly)

Formatting attributes of this cell.

Returns:



546
547
548
# File 'lib/natty-ui/helper/table.rb', line 546

def attributes
  @attributes
end

#empty?Boolean (readonly)

Returns true when this cell has no text and default attributes.

Returns:

  • (Boolean)


536
# File 'lib/natty-ui/helper/table.rb', line 536

def empty? = @text.empty? && @attributes.empty?

#textArray (readonly)

Text content of this cell.

Returns:

  • (Array)

    array of text values passed at construction



541
542
543
# File 'lib/natty-ui/helper/table.rb', line 541

def text
  @text
end