Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • irb/frame.rb

IRB::Frame

Public Class Methods

bottom(n = 0) click to toggle source

singleton functions

 
               # File irb/frame.rb, line 49
def Frame.bottom(n = 0)
  @backtrace.bottom(n)
end
            
new() click to toggle source
 
               # File irb/frame.rb, line 23
def initialize
  @frames = [TOPLEVEL_BINDING] * INIT_STACK_TIMES
end
            
sender() click to toggle source
 
               # File irb/frame.rb, line 57
def Frame.sender
  eval "self", @backtrace.top
end
            
top(n = 0) click to toggle source
 
               # File irb/frame.rb, line 53
def Frame.top(n = 0)
  @backtrace.top(n)
end
            

Public Instance Methods

bottom(n = 0) click to toggle source
 
               # File irb/frame.rb, line 42
def bottom(n = 0)
  bind = @frames[n]
  Fail FrameOverflow unless bind
  bind
end
            
top(n = 0) click to toggle source
 
               # File irb/frame.rb, line 36
def top(n = 0)
  bind = @frames[-(n + CALL_STACK_OFFSET)]
  Fail FrameUnderflow unless bind
  bind
end
            
trace_func(event, file, line, id, binding) click to toggle source
 
               # File irb/frame.rb, line 27
def trace_func(event, file, line, id, binding)
  case event
  when 'call', 'class'
    @frames.push binding
  when 'return', 'end'
    @frames.pop
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus