Top Description Fields Constructors Methods
org.jruby.runtime

public final Class Frame

extends Object
Class Inheritance
Imports
org.jruby.RubyModule, org.jruby.runtime.builtin.IRubyObject

A Frame holds per-call information that needs to persist outside the execution of a given method. Currently a frame holds the following: Frames are allocated for all Ruby methods (in compatibility mode, default) and for some core methods. In general, a frame is required for a method to show up in a backtrace, and so some methods only use frame for backtrace information (so-called "backtrace frames").
See Also
ThreadContext

Field Summary

Modifier and TypeField and Description
private IRubyObject
backRef

backref

private Block
block

The block that was passed in for this frame (as either a block or a &block argument).

pack-priv boolean
captured

whether this frame has been captured into a binding

public static final Frame
DUMMY

Deprecated
private RubyModule
klazz

The class against which this call is executing.

private IRubyObject
lastLine

lastline

private String
name

The name of the method being invoked in this frame.

private IRubyObject
self

The 'self' for this frame.

private Visibility
visibility

The current visibility for anything defined under this frame

Constructor Summary

AccessConstructor and Description
public
Frame()

Empty constructor, since Frame objects are pre-allocated and updated when needed.

private
Frame(Block nullBlock)

Used only by static init to avoid accessing NULL_BLOCK before initialized.

private
Frame(Frame frame)

Copy constructor, since Frame objects are pre-allocated and updated when needed.

Method Summary

Modifier and TypeMethod and Description
public Frame
public Frame
clear()

Clear the frame, as when the call completes.

public void
public Frame

Returns:

A new frame with duplicate information to the target frame
duplicate
()

Clone this frame.

public Frame

Returns:

A new frame with identical backtrace information to this frame
duplicateForBacktrace
()

Clone this frame for use in backtraces only (avoiding long-lived references to other elements.

public IRubyObject
public Block

Returns:

The block of this frame or NULL_BLOCK if no block given
getBlock
()

Retrieve the block associated with this frame.

public RubyModule

Returns:

The class we are calling against
getKlazz
()

Return class that we are calling against

public IRubyObject
public String

Returns:

the method name
getName
()

Get the method name associated with this frame

public IRubyObject

Returns:

The self for the frame
getSelf
()

Get the self associated with this frame

public Visibility

Returns:

The visibility
getVisibility
()

Get the visibility at the time of this frame

public boolean
public IRubyObject
public void
setCaptured(boolean captured)

public void
setKlazz(RubyModule
the new class
klazz
)

Set the class we are calling against.

public IRubyObject
public void
setName(String
the new name
name
)

Set the method name associated with this frame

public void
setSelf(IRubyObject
The new value of self
self
)

Set the self associated with this frame

public void
setVisibility(Visibility
The new visibility
visibility
)

Change the visibility associated with this frame

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
updateFrame()

Update the frame with just filename and line, used for top-level frames and method.

public void
updateFrame(String
The name of the method being called
name
)

Update the frame with caller information and method name, so it will show up correctly in call stacks.

public void
updateFrame(Frame
The frame whose data to duplicate in this frame
frame
)

Update the frame based on information from another frame.

public void
updateFrame(RubyModule
The class against which the method is being called
klazz
,
IRubyObject
The 'self' for the method
self
,
String
The name under which the method is being invoked
name
,
Block
The block passed to the method
block
)

Update the frame based on the given values.

public void
updateFrame(RubyModule
The class against which the method is being called
klazz
,
IRubyObject
The 'self' for the method
self
,
String
The name under which the method is being invoked
name
,
Visibility visibility, Block
The block passed to the method
block
)

Update the frame based on the given values.

public void
public void
updateFrameForEval(IRubyObject
The 'self' for the method
self
)

Update the frame based on the given values.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

backRefback to summary
private IRubyObject backRef

backref

blockback to summary
private Block block

The block that was passed in for this frame (as either a block or a &block argument). The frame captures the block for super/zsuper, but also for Proc.new (with no arguments) and also for block_given?. Both of those methods needs access to the block of the previous frame to work.

capturedback to summary
pack-priv boolean captured

whether this frame has been captured into a binding

DUMMYback to summary
public static final Frame DUMMY

Deprecated

Annotations
@Deprecated
klazzback to summary
private RubyModule klazz

The class against which this call is executing.

lastLineback to summary
private IRubyObject lastLine

lastline

nameback to summary
private String name

The name of the method being invoked in this frame.

selfback to summary
private IRubyObject self

The 'self' for this frame.

visibilityback to summary
private Visibility visibility

The current visibility for anything defined under this frame

Constructor Detail

Frameback to summary
public Frame()

Empty constructor, since Frame objects are pre-allocated and updated when needed.

Frameback to summary
private Frame(Block nullBlock)

Used only by static init to avoid accessing NULL_BLOCK before initialized.

Frameback to summary
private Frame(Frame frame)

Copy constructor, since Frame objects are pre-allocated and updated when needed.

Method Detail

captureback to summary
public Frame capture()
clearback to summary
public Frame clear()

Clear the frame, as when the call completes. Clearing prevents cached frames from holding references after the call is done.

clearFrameForBackrefback to summary
public void clearFrameForBackref()
duplicateback to summary
public Frame duplicate()

Clone this frame.

Returns:Frame

A new frame with duplicate information to the target frame

duplicateForBacktraceback to summary
public Frame duplicateForBacktrace()

Clone this frame for use in backtraces only (avoiding long-lived references to other elements.

Returns:Frame

A new frame with identical backtrace information to this frame

getBackRefback to summary
public IRubyObject getBackRef(IRubyObject nil)
getBlockback to summary
public Block getBlock()

Retrieve the block associated with this frame.

Returns:Block

The block of this frame or NULL_BLOCK if no block given

getKlazzback to summary
public RubyModule getKlazz()

Return class that we are calling against

Returns:RubyModule

The class we are calling against

getLastLineback to summary
public IRubyObject getLastLine(IRubyObject nil)
getNameback to summary
public String getName()

Get the method name associated with this frame

Returns:String

the method name

getSelfback to summary
public IRubyObject getSelf()

Get the self associated with this frame

Returns:IRubyObject

The self for the frame

getVisibilityback to summary
public Visibility getVisibility()

Get the visibility at the time of this frame

Returns:Visibility

The visibility

isCapturedback to summary
public boolean isCaptured()
setBackRefback to summary
public IRubyObject setBackRef(IRubyObject backRef)
setCapturedback to summary
public void setCaptured(boolean captured)
setKlazzback to summary
public void setKlazz(RubyModule klazz)

Set the class we are calling against.

Parameters
klazz:RubyModule

the new class

setLastLineback to summary
public IRubyObject setLastLine(IRubyObject lastLine)
setNameback to summary
public void setName(String name)

Set the method name associated with this frame

Parameters
name:String

the new name

setSelfback to summary
public void setSelf(IRubyObject self)

Set the self associated with this frame

Parameters
self:IRubyObject

The new value of self

setVisibilityback to summary
public void setVisibility(Visibility visibility)

Change the visibility associated with this frame

Parameters
visibility:Visibility

The new visibility

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
updateFrameback to summary
public void updateFrame()

Update the frame with just filename and line, used for top-level frames and method.

updateFrameback to summary
public void updateFrame(String name)

Update the frame with caller information and method name, so it will show up correctly in call stacks.

Parameters
name:String

The name of the method being called

updateFrameback to summary
public void updateFrame(Frame frame)

Update the frame based on information from another frame. Used for cloning frames (for blocks, usually) and when entering class bodies.

Parameters
frame:Frame

The frame whose data to duplicate in this frame

updateFrameback to summary
public void updateFrame(RubyModule klazz, IRubyObject self, String name, Block block)

Update the frame based on the given values.

Parameters
klazz:RubyModule

The class against which the method is being called

self:IRubyObject

The 'self' for the method

name:String

The name under which the method is being invoked

block:Block

The block passed to the method

updateFrameback to summary
public void updateFrame(RubyModule klazz, IRubyObject self, String name, Visibility visibility, Block block)

Update the frame based on the given values.

Parameters
klazz:RubyModule

The class against which the method is being called

self:IRubyObject

The 'self' for the method

name:String

The name under which the method is being invoked

block:Block

The block passed to the method

updateFrameForBackrefback to summary
public void updateFrameForBackref()
updateFrameForEvalback to summary
public void updateFrameForEval(IRubyObject self)

Update the frame based on the given values.

Parameters
self:IRubyObject

The 'self' for the method