Class: RubyTUI::Cell
- Inherits:
-
Object
- Object
- RubyTUI::Cell
- Defined in:
- lib/rubytui/cell.rb
Overview
Constant Summary collapse
- EMPTY_CHAR =
Default empty character (space).
" "
Instance Attribute Summary collapse
-
#style ⇒ Style
The style applied to this cell.
-
#symbol ⇒ String
The character displayed in this cell.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compare by symbol and style.
-
#empty? ⇒ Boolean
True if this cell has default content (space + default style).
-
#initialize(symbol = EMPTY_CHAR, style = Style::DEFAULT) ⇒ Cell
constructor
A new instance of Cell.
-
#reset! ⇒ self
Reset this cell to empty (space character, default style).
-
#set(symbol, style = Style::DEFAULT) ⇒ self
Set this cell's character and style.
Constructor Details
#initialize(symbol = EMPTY_CHAR, style = Style::DEFAULT) ⇒ Cell
Returns a new instance of Cell.
19 20 21 22 |
# File 'lib/rubytui/cell.rb', line 19 def initialize(symbol = EMPTY_CHAR, style = Style::DEFAULT) @symbol = symbol @style = style end |
Instance Attribute Details
#style ⇒ Style
Returns the style applied to this cell.
12 13 14 |
# File 'lib/rubytui/cell.rb', line 12 def style @style end |
#symbol ⇒ String
Returns the character displayed in this cell.
10 11 12 |
# File 'lib/rubytui/cell.rb', line 10 def symbol @symbol end |
Instance Method Details
#==(other) ⇒ Boolean
Compare by symbol and style.
48 49 50 |
# File 'lib/rubytui/cell.rb', line 48 def ==(other) other.is_a?(Cell) && @symbol == other.symbol && @style == other.style end |
#empty? ⇒ Boolean
Returns true if this cell has default content (space + default style).
53 |
# File 'lib/rubytui/cell.rb', line 53 def empty? = @symbol == EMPTY_CHAR && @style == Style::DEFAULT |
#reset! ⇒ self
Reset this cell to empty (space character, default style).
27 28 29 30 31 |
# File 'lib/rubytui/cell.rb', line 27 def reset! @symbol = EMPTY_CHAR @style = Style::DEFAULT self end |