Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="https://rubygems.org/search?utf8=%E2%9C%93&amp;query=ruby-debug-base" rel="nofollow"><em>ruby-debug-base</em></a> gem adds a binding_n method to the <em>Kernel</em> module and this will give you access binding object that can be used in an <em>eval</em> to give access to call-stack variables. Remember to issue <em>Debugger.start</em> to turn on call stack tracking.</p> <p>Here is an example showing its use to introspect what is going on inside <em>irb</em> (a Ruby program). One could put the <em>require</em>'s and <em>Debugger.start</em> inside your own Ruby code as well.</p> <pre><code>$ irb ruby-1.8.7-p302 &gt; require 'rubygems' =&gt; true ruby-1.8.7-p302 &gt; require 'ruby-debug-base' =&gt; true ruby-1.8.7-p302 &gt; Debugger.start =&gt; true ruby-1.8.7-p302 &gt; puts caller /tmp/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb/workspace.rb:52 :i n `irb_binding' #` /tmp/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/irb/workspace.rb:52 =&gt; nil ruby-1.8.7-p302 &gt; eval "main", binding_n(2) =&gt; #&lt;Object:0xb7762958 @prompt={:PROMPT_I=&gt;"ruby-1.8.7-p302 &gt; ", :PROMPT_N=&gt;" ruby-1.8.7-p302 ?&gt; ", :PROMPT_S=&gt;"ruby-1.8.7-p302%l&gt; ", :PROMPT_C=&gt;"ruby-1.8.7-p302 &gt; ", :AUTO_INDENT=&gt;true, :RETURN=&gt;" =&gt; %s \n"}&gt; ruby-1.8.7-p302 &gt; </code></pre> <p>If you are willing to run a patched version of Ruby for 1.9.2 see <a href="http://gitnub.com/rocky/rb-threadframe" rel="nofollow">http://gitnub.com/rocky/rb-threadframe</a> for what I think is better access to the call stack. <a href="http://rubini.us" rel="nofollow">Rubinius</a> provides this capability built in via <em>Rubinius::VM.backtrace</em>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload