How to debug ruby code?

后端 未结 9 2067
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 15:04

I run Ubuntu 10.10. I just want to debug a simple script. After spending half a day trying to figure out how that could be done I give up. What the heck am I supposed to do?

9条回答
  •  有刺的猬
    2020-12-28 15:53

    pry is better compared to IRB. The following are grab from its README.

    Pry is a powerful alternative to the standard IRB shell for Ruby. It is written from scratch to provide a number of advanced features, including:

    • Source code browsing (including core C source with the pry-doc gem)
    • Documentation browsing
    • Live help system
    • Open methods in editors (edit-method Class#method)
    • Syntax highlighting
    • Command shell integration (start editors, run git, and rake from within Pry)
    • Gist integration
    • Navigation around state (cd, ls and friends)
    • Runtime invocation (use Pry as a developer console or debugger)
    • Exotic object support (BasicObject instances, IClasses, ...)
    • A Powerful and flexible command system
    • Ability to view and replay history

    • Many convenience commands inspired by IPython, Smalltalk and other advanced REPLs

    • A wide-range number of plugins that provide remote sessions, full debugging functionality, and more.

    Pry also aims to be more than an IRB replacement; it is an attempt to bring REPL driven programming to the Ruby language. It is currently not as powerful as tools like SLIME for lisp, but that is the general direction Pry is heading.

    Pry is also fairly flexible and allows significant user customization is trivial to set it to read from any object that has a readline method and write to any object that has a puts method - many other aspects of Pry are also configurable making it a good choice for implementing custom shells.

提交回复
热议问题