Class: RubyProf::FlameGraphHtmlPrinter

Inherits:
AbstractPrinter show all
Includes:
ERB::Util
Defined in:
lib/ruby-prof/printers/flame_graph_html_printer.rb

Instance Method Summary collapse

Methods inherited from AbstractPrinter

#initialize, #method_name, #min_percent, #print_file, #print_footer, #print_header, #print_thread, #print_threads, #sort_method

Constructor Details

This class inherits a constructor from RubyProf::AbstractPrinter

Instance Method Details


17
18
19
20
21
22
23
24
# File 'lib/ruby-prof/printers/flame_graph_html_printer.rb', line 17

def print(output=STDOUT, options={})
  @output = output
  setup_options(options)

  str = @erb.result(binding)
  @output << str.split("\n").map(&:rstrip).join("\n")
  @output << "\n"
end

#setup_options(options = {}) ⇒ Object


8
9
10
11
12
13
14
15
# File 'lib/ruby-prof/printers/flame_graph_html_printer.rb', line 8

def setup_options(options={})
  super(options)

  ref = 'tmpl.html.erb'
  template = read_asset(ref)
  @erb = ERB.new(template)
  @erb.filename = ref
end