Class: RubyProf::CallTreeAbstractPrinter
- Inherits:
-
Object
- Object
- RubyProf::CallTreeAbstractPrinter
show all
- Defined in:
- lib/ruby-prof/call_tree/abstract_printer.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CallTreeAbstractPrinter.
3
4
5
6
|
# File 'lib/ruby-prof/call_tree/abstract_printer.rb', line 3
def initialize(call_tree, min_percentage=0)
@call_tree = call_tree
@min_percentage = min_percentage.to_f
end
|
Instance Method Details
20
21
22
|
# File 'lib/ruby-prof/call_tree/abstract_printer.rb', line 20
def format_method(method)
raise "abstract"
end
|
#print(io) ⇒ Object
8
9
10
|
# File 'lib/ruby-prof/call_tree/abstract_printer.rb', line 8
def print(io)
print_methods(io, @call_tree.children)
end
|
#print_methods(io, methods, parent_time = nil) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/ruby-prof/call_tree/abstract_printer.rb', line 12
def print_methods(io, methods, parent_time=nil)
methods.sort_by{|m| m.time}.reverse.each do |method|
io << format_method(method)
next if parent_time and method.time < parent_time * @min_percentage / 100
print_methods(io, method.children, method.time)
end
end
|