Class: RSpecDocumentation::Formatters::Ruby
- Inherits:
-
Object
- Object
- RSpecDocumentation::Formatters::Ruby
- Defined in:
- lib/rspec_documentation/formatters/ruby.rb
Overview
Default formatter for all RSpec examples. Used by all examples to generate the “Spec” tab content, i.e. the original source of the example code.
Instance Method Summary collapse
-
#initialize(subject:) ⇒ Ruby
constructor
A new instance of Ruby.
- #prettified_output ⇒ Object
- #render_raw? ⇒ Boolean
- #rendered_output ⇒ Object
Constructor Details
#initialize(subject:) ⇒ Ruby
Returns a new instance of Ruby.
8 9 10 |
# File 'lib/rspec_documentation/formatters/ruby.rb', line 8 def initialize(subject:) @subject = subject end |
Instance Method Details
#prettified_output ⇒ Object
12 13 14 |
# File 'lib/rspec_documentation/formatters/ruby.rb', line 12 def prettified_output nil end |
#render_raw? ⇒ Boolean
24 25 26 |
# File 'lib/rspec_documentation/formatters/ruby.rb', line 24 def render_raw? false end |
#rendered_output ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rspec_documentation/formatters/ruby.rb', line 16 def rendered_output formatter = Rouge::Formatters::HTML.new lexer = Rouge::Lexers::Ruby.new io = StringIO.new PP.pp(subject, io) formatter.format(lexer.lex(io.string)) end |