Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trace the code in Ruby? [closed]

Is there a good way to run a script and see all the steps:

  • Which code is executed
  • Which file the code is in
  • What it returns
  • The error messages

This would be a good way to learn how an open source project is working.

Aren't there solutions like this for Ruby?

Eg.

require "httparty"
HTTParty.get "http://www.google.se"

Then it would run the code and show me all the code it is executing, in which file and line, returned objects, error messages etc.

like image 518
never_had_a_name Avatar asked Sep 14 '10 06:09

never_had_a_name


1 Answers

Tracer might do it for you http://en.wikibooks.org/wiki/Ruby_Programming/Standard_Library/Tracer

if you want to just see exceptions raised, then run ruby -d (or use ruby-debug and "Catch" Exception)

like image 88
rogerdpack Avatar answered Sep 22 '22 04:09

rogerdpack