Module: Termplot::Renderable

Included in:
Renderer, Widgets::BaseWidget
Defined in:
lib/termplot/renderable.rb

Instance Method Summary collapse

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/termplot/renderable.rb', line 31

def debug?
  @debug
end

#renderObject

Included in any module that has the ivars:

:window
:errors
:debug

And methods:

#render_tO_window

Provides rendering to string and stdout



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/termplot/renderable.rb', line 10

def render
  rendered_string = render_to_string
  if debug?
    rendered_string.each do |row|
      print row
    end
  else
    print rendered_string
    STDOUT.flush
  end

  if errors.any?
    window.print_errors(errors)
  end
end

#render_to_stringObject



26
27
28
29
# File 'lib/termplot/renderable.rb', line 26

def render_to_string
  render_to_window
  debug? ? window.flush_debug : window.flush
end