Class: RSpecDocumentation::Formatters::Ansi

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_documentation/formatters/ansi.rb

Overview

Outputs a string containing ANSI color code escape sequences into HTML with attached classes for each matched color code. Cleans any remaining escape codes.

Instance Method Summary collapse

Constructor Details

#initialize(subject:) ⇒ Ansi

Returns a new instance of Ansi.



10
11
12
# File 'lib/rspec_documentation/formatters/ansi.rb', line 10

def initialize(subject:)
  @subject = subject
end

Instance Method Details

#prettified_outputObject



14
15
16
# File 'lib/rspec_documentation/formatters/ansi.rb', line 14

def prettified_output
  nil
end

#render_raw?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/rspec_documentation/formatters/ansi.rb', line 22

def render_raw?
  false
end

#rendered_outputObject



18
19
20
# File 'lib/rspec_documentation/formatters/ansi.rb', line 18

def rendered_output
  "<div class='ansi-html border m-1 p-4'><span>#{subbed_content}</span></div>"
end