Class: GLW::Screen::UpdateBlock
- Inherits:
-
Data
- Object
- Data
- GLW::Screen::UpdateBlock
- Defined in:
- lib/glw/screen.rb
Instance Attribute Summary collapse
-
#cells ⇒ Object
readonly
Returns the value of attribute cells.
-
#start_index ⇒ Object
readonly
Returns the value of attribute start_index.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cells ⇒ Object (readonly)
Returns the value of attribute cells
4 5 6 |
# File 'lib/glw/screen.rb', line 4 def cells @cells end |
#start_index ⇒ Object (readonly)
Returns the value of attribute start_index
4 5 6 |
# File 'lib/glw/screen.rb', line 4 def start_index @start_index end |
Class Method Details
.make(start_index) ⇒ Object
5 |
# File 'lib/glw/screen.rb', line 5 def self.make(start_index) = new(start_index, []) |
Instance Method Details
#to_s(current_fg: nil, current_bg: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/glw/screen.rb', line 7 def to_s(current_fg: nil, current_bg: nil) output = "" fg = current_fg bg = current_bg cells.each do |cell| if cell.fg_color != fg output << Terminal.set_fg(cell.fg_color) fg = cell.fg_color end if cell.bg_color != bg output << Terminal.set_bg(cell.bg_color) bg = cell.bg_color end output << cell.char end [output, fg, bg] end |