Class: RubyRich::CacheRender
- Inherits:
-
Object
- Object
- RubyRich::CacheRender
- Defined in:
- lib/ruby_rich/live.rb
Instance Method Summary collapse
- #draw(buffer) ⇒ Object
-
#initialize ⇒ CacheRender
constructor
A new instance of CacheRender.
- #print_with_pos(x, y, text) ⇒ Object
Constructor Details
#initialize ⇒ CacheRender
Returns a new instance of CacheRender.
11 12 13 |
# File 'lib/ruby_rich/live.rb', line 11 def initialize @cache = nil end |
Instance Method Details
#draw(buffer) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ruby_rich/live.rb', line 20 def draw(buffer) unless @cache RubyRich::Terminal.clear draw_full(buffer) @cache = buffer else draw_changes(buffer) end end |
#print_with_pos(x, y, text) ⇒ Object
15 16 17 18 |
# File 'lib/ruby_rich/live.rb', line 15 def print_with_pos(x,y,text) print "\e[#{y};#{x}H" # Move cursor to top-left print text end |