Class: RSpecDocumentation::Formatters::Xml
- Inherits:
-
Object
- Object
- RSpecDocumentation::Formatters::Xml
- Defined in:
- lib/rspec_documentation/formatters/xml.rb
Overview
Produces prettified XML to from an RSpec ‘subject` value.
Instance Method Summary collapse
-
#initialize(subject:) ⇒ Xml
constructor
A new instance of Xml.
- #prettified_output ⇒ Object
- #render_raw? ⇒ Boolean
- #rendered_output ⇒ Object
Constructor Details
#initialize(subject:) ⇒ Xml
Returns a new instance of Xml.
7 8 9 |
# File 'lib/rspec_documentation/formatters/xml.rb', line 7 def initialize(subject:) @subject = subject end |
Instance Method Details
#prettified_output ⇒ Object
11 12 13 |
# File 'lib/rspec_documentation/formatters/xml.rb', line 11 def prettified_output nil end |
#render_raw? ⇒ Boolean
21 22 23 |
# File 'lib/rspec_documentation/formatters/xml.rb', line 21 def render_raw? false end |
#rendered_output ⇒ Object
15 16 17 18 19 |
# File 'lib/rspec_documentation/formatters/xml.rb', line 15 def rendered_output formatter = Rouge::Formatters::HTML.new lexer = Rouge::Lexers::XML.new formatter.format(lexer.lex(Nokogiri::XML.parse(subject).to_xml)) end |