Class: Kward::PtyTranscriptNormalizer::Line
- Inherits:
-
Object
- Object
- Kward::PtyTranscriptNormalizer::Line
- Defined in:
- lib/kward/pty_transcript_normalizer.rb
Overview
Applies the horizontal cursor controls accepted by AdaptivePtyOutputSink without modeling a complete terminal screen.
Instance Method Summary collapse
-
#initialize(text) ⇒ Line
constructor
A new instance of Line.
- #render ⇒ Object
Constructor Details
#initialize(text) ⇒ Line
Returns a new instance of Line.
22 23 24 25 26 |
# File 'lib/kward/pty_transcript_normalizer.rb', line 22 def initialize(text) @text = text @cells = [] @cursor = 0 end |
Instance Method Details
#render ⇒ Object
28 29 30 31 32 33 |
# File 'lib/kward/pty_transcript_normalizer.rb', line 28 def render ANSI.scan_escape_tokens(@text).each do |token| token[:escape] ? apply_escape(token[:text]) : write_text(token[:text]) end @cells.join.rstrip end |