class RubyProf::CallTreeVisitor
The call info visitor class does a depth-first traversal across a list of call infos. At each call_tree node, the visitor executes the block provided in the visit
method. The block is passed two parameters, the event and the call_tree instance. Event will be either :enter or :exit.
visitor = RubyProf::CallTreeVisitor.new(result.threads.first.call_tree) method_names = Array.new visitor.visit do |call_tree, event| method_names << call_tree.target.full_name if event == :enter end puts method_names
Public Class Methods
new(call_tree)
click to toggle source
# File lib/ruby-prof/call_tree_visitor.rb 18 def initialize(call_tree) 19 @call_tree = call_tree 20 end
Public Instance Methods
visit(&block)
click to toggle source
# File lib/ruby-prof/call_tree_visitor.rb 22 def visit(&block) 23 visit_call_tree(@call_tree, &block) 24 end