Method: RSpecDocumentation::Formatters::Yaml#rendered_output

Defined in:
lib/rspec_documentation/formatters/yaml.rb

#rendered_outputObject



15
16
17
18
19
20
21
# File 'lib/rspec_documentation/formatters/yaml.rb', line 15

def rendered_output
  formatter = Rouge::Formatters::HTML.new
  lexer = Rouge::Lexers::YAML.new
  formatter.format(lexer.lex(YAML.safe_load(subject, permitted_classes: permitted_classes).to_yaml))
rescue Psych::SyntaxError => e
  raise Error, "Expected YAML for:\n#{subject}\n\nSyntax Error: #{e}"
end