Created: 2008-10-03 00:43
Updated: 2016-05-08 14:18



By using Ruby's Bindings, you can find a lot of stuff :-)


After requiring memory_dump, insert the following line anywhere in your code:


This will give you a nested Hash containing most variables accessible from where you called it, as well as a few other interesting tidbits:

{:instance_variables=>{"@instance_variable"=>"instance var's value"},
 :local_variables=>{"local"=>"local var's value"},
 :class_variables=>{"@@class_variable"=>"class var's value"},
 :ancestors=>[YourClass, YourMom, Object],

If you're ready for an explosion of (very interesting) information, call it in verbose mode:


Included in the previous hash will be two additional hashes of name-value pairs. One containing all the global variables and the other one containing all the accessible constants.

Note: all keys for buckets generated by the tool are symbols. All other keys (variable names, constants, etc) are strings.

Other stuff

To know more about bindings, check out

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more