Class: RubyRich::CacheRender

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_rich/live.rb

Instance Method Summary collapse

Constructor Details

#initializeCacheRender

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


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