Class: UnicodePlot::Renderer

Inherits:
Object
  • Object
show all
Includes:
BorderPrinter
Defined in:
src/lib/unicode_plot/renderer.rb

Constant Summary

Constants included from StyledPrinter

StyledPrinter::COLOR_DECODE, StyledPrinter::COLOR_ENCODE, StyledPrinter::DISABLE_TEXT_STYLE, StyledPrinter::TEXT_COLORS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BorderPrinter

#print_border_bottom, #print_border_top

Methods included from StyledPrinter

#print_color, #print_styled

Constructor Details

#initialize(plot) ⇒ Renderer

Returns a new instance of Renderer.



70
71
72
73
# File 'src/lib/unicode_plot/renderer.rb', line 70

def initialize(plot)
  @plot = plot
  @out = nil
end

Instance Attribute Details

#outObject (readonly)

Returns the value of attribute out.



76
77
78
# File 'src/lib/unicode_plot/renderer.rb', line 76

def out
  @out
end

#plotObject (readonly)

Returns the value of attribute plot.



75
76
77
# File 'src/lib/unicode_plot/renderer.rb', line 75

def plot
  @plot
end

Class Method Details

.render(out, plot, newline) ⇒ Object



66
67
68
# File 'src/lib/unicode_plot/renderer.rb', line 66

def self.render(out, plot, newline)
  new(plot).render(out, newline)
end

Instance Method Details

#render(out, newline) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'src/lib/unicode_plot/renderer.rb', line 78

def render(out, newline)
  @out = out
  init_render

  render_top
  render_rows
  render_bottom
  out.puts if newline
end