class RubyProf::FlameGraphHtmlPrinter
Public Instance Methods
print(output=STDOUT, options={})
click to toggle source
# 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={})
click to toggle source
Calls superclass method
RubyProf::AbstractPrinter#setup_options
# 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
Private Instance Methods
css_libraries_html()
click to toggle source
# File lib/ruby-prof/printers/flame_graph_html_printer.rb, line 28 def css_libraries_html read_asset('lib.css.html') end
data_json()
click to toggle source
# File lib/ruby-prof/printers/flame_graph_html_printer.rb, line 46 def data_json StringIO.new.tap { |strio| jp = FlameGraphJsonPrinter.new(@result) jp.print(strio, @options) }.string end
js_code_html()
click to toggle source
# File lib/ruby-prof/printers/flame_graph_html_printer.rb, line 36 def js_code_html read_asset('page.js.html') end
js_data_html()
click to toggle source
# File lib/ruby-prof/printers/flame_graph_html_printer.rb, line 40 def js_data_html "<script type=\"text/javascript\">\n\n" \ "var data = #{data_json};\n\n" \ "</script>\n" end
js_libraries_html()
click to toggle source
# File lib/ruby-prof/printers/flame_graph_html_printer.rb, line 32 def js_libraries_html read_asset('lib.js.html') end
read_asset(ref)
click to toggle source
# File lib/ruby-prof/printers/flame_graph_html_printer.rb, line 53 def read_asset(ref) base_path = File.expand_path('../../assets', __FILE__) file_path = File.join(base_path, "flame_graph_printer.#{ref}") File.open(file_path, 'rb').read.strip.untaint end