Class: Termplot::Renderers::TextRenderer
- Inherits:
-
Object
- Object
- Termplot::Renderers::TextRenderer
- Defined in:
- lib/termplot/renderers/text_renderer.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
-
#initialize(bordered_window:, text:, row:, errors:, align: :center) ⇒ TextRenderer
constructor
A new instance of TextRenderer.
- #render ⇒ Object
Constructor Details
#initialize(bordered_window:, text:, row:, errors:, align: :center) ⇒ TextRenderer
Returns a new instance of TextRenderer.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/termplot/renderers/text_renderer.rb', line 14 def initialize( bordered_window:, text:, row:, errors:, align: :center ) @window = bordered_window @text = Termplot::Utils::AnsiSafeString.new(text) @row = row @errors = errors @align = align end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
6 7 8 |
# File 'lib/termplot/renderers/text_renderer.rb', line 6 def align @align end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/termplot/renderers/text_renderer.rb', line 6 def errors @errors end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
6 7 8 |
# File 'lib/termplot/renderers/text_renderer.rb', line 6 def row @row end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/termplot/renderers/text_renderer.rb', line 6 def text @text end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
6 7 8 |
# File 'lib/termplot/renderers/text_renderer.rb', line 6 def window @window end |
Instance Method Details
#render ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/termplot/renderers/text_renderer.rb', line 29 def render window.cursor.row = row window.cursor.beginning_of_line window.cursor.forward(position) clamped_text.each do |char| window.write(char) end end |