class RubyProf::AbstractPrinter

  1. lib/ruby-prof/abstract_printer.rb
Parent: RubyProf

Methods

Public Class

  1. new

Public Instance

  1. method_name
  2. min_percent
  3. print_file
  4. setup_options
  5. sort_method

Public Class methods

new (result)
[show source]
# File lib/ruby-prof/abstract_printer.rb, line 4
def initialize(result)
  @result = result
  @output = nil
  @options = {}
end

Public Instance methods

method_name (method)
[show source]
# File lib/ruby-prof/abstract_printer.rb, line 42
def method_name(method)
  name = method.full_name
  if print_file
    name += " (#{method.source_file}:#{method.line}}"
  end
  name
end
min_percent ()
[show source]
# File lib/ruby-prof/abstract_printer.rb, line 30
def min_percent
  @options[:min_percent] || 0
end
print_file ()
[show source]
# File lib/ruby-prof/abstract_printer.rb, line 34
def print_file
  @options[:print_file] || false
end
setup_options (options = {})

Specify print options.

options - Hash table

:min_percent - Number 0 to 100 that specifes the minimum
               %self (the methods self time divided by the
               overall total time) that a method must take
               for it to be printed out in the report.
               Default value is 0.
:print_file  - True or false. Specifies if a method's source
               file should be printed.  Default value if false.

:sort_method - Specifies method used for sorting method infos.
               Available values are :total_time, :self_time,
               :wait_time, :children_time
               Default value is :total_time
[show source]
# File lib/ruby-prof/abstract_printer.rb, line 26
def setup_options(options = {})
  @options = options
end
sort_method ()
[show source]
# File lib/ruby-prof/abstract_printer.rb, line 38
def sort_method
  @options[:sort_method] || :total_time
end