class Rack::WebProfiler::Rouge::HTMLFormatter

Public Class Methods

new(opts = {}) click to toggle source

Initialize the Formatter.

@param request [Hash]

# 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

Public Instance Methods

stream(tokens, &b) click to toggle source

@yield the html output.

# File lib/rack/web_profiler/rouge/html_formatter.rb, line 21
def stream(tokens, &b)
  @formatter.stream(tokens, &b)
end