Class: TTYString

Inherits:
Object
  • Object
show all
Defined in:
lib/tty_string.rb,
lib/tty_string/cursor.rb,
lib/tty_string/parser.rb,
lib/tty_string/screen.rb,
lib/tty_string/version.rb,
lib/tty_string/renderer.rb

Overview

Renders a string taking into ANSI escape codes and trn etc Usage: TTYString.new(“thisre[Kthat”).to_s => “that”

Defined Under Namespace

Classes: Cursor, Parser, Renderer, Screen

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Constructor Details

#initialize(input_string, clear_style: true) ⇒ TTYString

Returns a new instance of TTYString.



8
9
10
11
# File 'lib/tty_string.rb', line 8

def initialize(input_string, clear_style: true)
  @parser = Parser.new(input_string)
  @clear_style = clear_style
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/tty_string.rb', line 13

def to_s
  parser.render(clear_style: clear_style)
end