Class: Tui::Section
- Inherits:
-
Object
- Object
- Tui::Section
- Defined in:
- lib/tui.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
Instance Method Summary collapse
- #add_line(background: nil, truncate: true) {|line| ... } ⇒ Object
- #clear ⇒ Object
- #divider(char: '─') ⇒ Object
-
#initialize(screen) ⇒ Section
constructor
A new instance of Section.
Constructor Details
#initialize(screen) ⇒ Section
Returns a new instance of Section.
475 476 477 478 |
# File 'lib/tui.rb', line 475 def initialize(screen) @screen = screen @lines = [] end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
473 474 475 |
# File 'lib/tui.rb', line 473 def lines @lines end |
Instance Method Details
#add_line(background: nil, truncate: true) {|line| ... } ⇒ Object
480 481 482 483 484 485 |
# File 'lib/tui.rb', line 480 def add_line(background: nil, truncate: true) line = Line.new(@screen, background: background, truncate: truncate) @lines << line yield line if block_given? line end |
#clear ⇒ Object
494 495 496 |
# File 'lib/tui.rb', line 494 def clear @lines.clear end |
#divider(char: '─') ⇒ Object
487 488 489 490 491 492 |
# File 'lib/tui.rb', line 487 def divider(char: '─') add_line do |line| span = [@screen.width - 1, 1].max line.write << char * span end end |