Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Tool to save eval'ed code strings to a file, first, as eval time
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
ChangeLog
README
remembered_evals.gemspec

README

remembered_evals:

A library to make debugging eval'ed code possible.  

This library monkey patches Kernel.*eval to save eval'ed code to a cache file before evaluating it (files saved to ~/._remembered_evals/hash_of_that_code).

You can thus debug [ex: using ruby-debug] THROUGH eval'ed code, now, as well as see appropriate (useful) eval'ed code lines in exception backtraces, instead of just eval(2) as the line number in the backtrace.

It also offers an additional tool for developers:  Since it saves code by hash value, and doesn't write over cached files, you can actually edit eval'ed blocks and it will eval the edited version--i.e. it allows you to override certain strings passed to eval [it uses yours instead of the original]-- quite useful for debugging purposes if you use meta-programming heavily.

Note also that it breaks eval'ed code that assumes the default binding, i.e.
eval("a = 4") # this won't work right
eval("a = 4", binding) # works though

The small price we pay for debugging convenience.  To minimize the impact of this, require all other gems before this one.

Competition:
None known

Install:
$ gem sources -a http://gems.github.com # if necessary
$ gem install rogerdpack-remembered_evals # may need to precede with sudo

require 'remembered_evals' at the beginning of your script, then enjoy the eval'ed code bliss.

Feedback welcome rdp@github
Something went wrong with that request. Please try again.