Class: NattyUI::Table::Cell
- Inherits:
-
Object
- Object
- NattyUI::Table::Cell
- 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
-
#attributes ⇒ Cell::Attributes
readonly
Formatting attributes of this cell.
-
#empty? ⇒ Boolean
readonly
Returns
truewhen this cell has no text and default attributes. -
#text ⇒ Array
readonly
Text content of this cell.
Instance Method Summary collapse
-
#initialize(*text, **attributes) ⇒ Cell
constructor
A new instance of Cell.
Constructor Details
#initialize(*text, **attributes) ⇒ Cell
Returns a new instance of Cell.
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
#attributes ⇒ Cell::Attributes (readonly)
Formatting attributes of this cell.
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.
536 |
# File 'lib/natty-ui/helper/table.rb', line 536 def empty? = @text.empty? && @attributes.empty? |
#text ⇒ Array (readonly)
Text content of this cell.
541 542 543 |
# File 'lib/natty-ui/helper/table.rb', line 541 def text @text end |