Module: RSpecDocumentation::Formatters

Defined in:
lib/rspec_documentation/formatters.rb,
lib/rspec_documentation/formatters/xml.rb,
lib/rspec_documentation/formatters/ansi.rb,
lib/rspec_documentation/formatters/html.rb,
lib/rspec_documentation/formatters/json.rb,
lib/rspec_documentation/formatters/ruby.rb,
lib/rspec_documentation/formatters/yaml.rb

Overview

Provides a set of formatters for rendering the value of a ‘subject` in an RSpec example into a useful format according to the language specified in the relevant Markdown code block, e.g. `rspec:html` will use the `Html` formatter to render beautified HTML source and the rendered output.

Defined Under Namespace

Classes: Ansi, Html, Json, Ruby, Xml, Yaml

Constant Summary collapse

COLOR_CODES =
[0, 1, 2, 3, 4, 5, 6, 7, 9].freeze

Class Method Summary collapse

Class Method Details

.with_translated_html_entities(content) ⇒ Object



16
17
18
19
# File 'lib/rspec_documentation/formatters.rb', line 16

def self.with_translated_html_entities(content)
  content&.gsub("\n", '<br/>')
         &.gsub('  ', '&nbsp;&nbsp;')
end