class LineProf::Report

Public Class Methods

report(profile, options = {}) click to toggle source
# File lib/rblineprof/report.rb, line 14
def self.report(profile, options = {})
  self.new.report(profile, options)
end

Public Instance Methods

format_profile(profile, options = {}) click to toggle source
# File lib/rblineprof/report.rb, line 37
def format_profile(profile, options = {})
  sources = profile.map do |filename, samples|
    Source.new filename, samples, options
  end

  sources.map(&:format).compact.join "\n"
end
out_open(path) { |io| ... } click to toggle source
# File lib/rblineprof/report.rb, line 29
def out_open(path)
  if path
    File.open(path, 'a') {|io| yield(io) }
  else
    yield($stdout)
  end
end
report(profile, options = {}) click to toggle source

options

:context
:thresholds
:out
# File lib/rblineprof/report.rb, line 22
def report(profile, options = {})
  out_open(options[:out]) do |io|
    io.puts Term::ANSIColor.blue("\n[LineProf] #{'=' * 63}") << "\n\n" <<
      format_profile(profile, options) << "\n"
  end
end