Class: TuiTui::Span
- Inherits:
-
Data
- Object
- Data
- TuiTui::Span
- Defined in:
- lib/tui_tui/span.rb
Overview
A run of text sharing one Style. Width is terminal-column aware via DisplayText.
Instance Attribute Summary collapse
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
-
.[](text, style = nil) ⇒ Object
Convenience constructor: Span[“hi”, style] (style optional).
Instance Method Summary collapse
Instance Attribute Details
#style ⇒ Object (readonly)
Returns the value of attribute style
8 9 10 |
# File 'lib/tui_tui/span.rb', line 8 def style @style end |
#text ⇒ Object (readonly)
Returns the value of attribute text
8 9 10 |
# File 'lib/tui_tui/span.rb', line 8 def text @text end |
Class Method Details
.[](text, style = nil) ⇒ Object
Convenience constructor: Span[“hi”, style] (style optional).
10 |
# File 'lib/tui_tui/span.rb', line 10 def self.[](text, style = nil) = new(text: text.to_s, style: style) |
Instance Method Details
#width ⇒ Object
12 |
# File 'lib/tui_tui/span.rb', line 12 def width = DisplayText.new(text).width |