Class: RubyProf::AbstractPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-prof/abstract_printer.rb

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ AbstractPrinter

Returns a new instance of AbstractPrinter.



3
4
5
6
7
# File 'lib/ruby-prof/abstract_printer.rb', line 3

def initialize(result)
  @result = result
  @output = nil
  @options = {}
end

Instance Method Details

#method_name(method) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/ruby-prof/abstract_printer.rb', line 33

def method_name(method)
  name = method.full_name
  if print_file
    name += " (#{method.source_file}:#{method.line}}"
  end
  name
end

#min_percentObject



25
26
27
# File 'lib/ruby-prof/abstract_printer.rb', line 25

def min_percent
  @options[:min_percent] || 0
end


29
30
31
# File 'lib/ruby-prof/abstract_printer.rb', line 29

def print_file
  @options[:print_file] || false
end

#setup_options(options = {}) ⇒ Object

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.


21
22
23
# File 'lib/ruby-prof/abstract_printer.rb', line 21

def setup_options(options = {})
  @options = options
end