Class: Rack::WebProfiler::Rouge::HTMLFormatter

Inherits:
Rouge::Formatter
  • Object
show all
Defined in:
lib/rack/web_profiler/rouge/html_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ HTMLFormatter

Initialize the Formatter.

Parameters:

  • request (Hash)


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rack/web_profiler/rouge/html_formatter.rb', line 8

def initialize(opts = {})
  @formatter = opts[:inline_theme] \
    ? ::Rouge::Formatters::HTMLInline.new(opts[:inline_theme])
    : ::Rouge::Formatters::HTML.new

  if opts[:line_numbers]
    @formatter = ::Rouge::Formatters::HTMLTable.new(@formatter, opts)
  else
    @formatter = ::Rouge::Formatters::HTMLPygments.new(@formatter)
  end
end

Instance Method Details

#stream(tokens) { ... } ⇒ Object

Yields:

  • the html output.



21
22
23
# File 'lib/rack/web_profiler/rouge/html_formatter.rb', line 21

def stream(tokens, &b)
  @formatter.stream(tokens, &b)
end