Skip to content

Instantly share code, notes, and snippets.

@KacperPucek
Last active July 29, 2016 10:58
Show Gist options
  • Save KacperPucek/8c01565328b48423804da2784368654b to your computer and use it in GitHub Desktop.
Save KacperPucek/8c01565328b48423804da2784368654b to your computer and use it in GitHub Desktop.
class A
def a
b
end
def b
c
end
def c
puts "Hello World"
end
end
set_trace_func proc { |event, file, line, id, binding, classname|
if event != "call" || file[/\/spec\//].nil?
nil
else
printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
end
}
A.new.a
set_trace_func nil
event | path_to_file | method | class
call /Users/kacperpucek/tailored.to/spec/use_cases/create_product_spec.rb:14 a A
call /Users/kacperpucek/tailored.to/spec/use_cases/create_product_spec.rb:18 b A
call /Users/kacperpucek/tailored.to/spec/use_cases/create_product_spec.rb:22 c A
http://apidock.com/ruby/Kernel/set_trace_func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment