Top Description Fields Constructors Methods
org.jruby.embed.variable

public Class TransientLocalVariable

extends AbstractVariable
Class Inheritance
Imports
org.jruby.embed.internal.BiVariableMap, org.jruby.RubyObject

An implementation of BiVariable for a transient local variable. This type of a local variable is available during only one evaluation. After the evaluation, the variable vanishes.
Author
Yoko Harada <[email protected]>

Field Summary

Modifier and TypeField and Description
private static final String
Inherited from org.jruby.embed.variable.AbstractVariable:
fromRubyjavaObjectjavaTypenamereceiverrubyObject

Constructor Summary

AccessConstructor and Description
private
TransientLocalVariable(RubyObject receiver, String name, Object... javaObjects)

Method Summary

Modifier and TypeMethod and Description
public static BiVariable

Returns:

the instance of TransientLocalVariable
getInstance
(RubyObject
receiver object returned when a script is evaluated.
receiver
,
String
a variable name
name
,
Object...
Java object that should be assigned to.
javaObject
)

Returns an instance of this class.

public BiVariable.Type

Returns:

this enum type, BiVariable.Type.LocalVariable.
getType
()

Implements org.jruby.embed.variable.BiVariable.getType.

Returns enum type of this variable defined in BiVariable.

public void
inject()

Implements org.jruby.embed.variable.BiVariable.inject.

Injects a local variable value to a parsed Ruby script.

public static boolean

Returns:

true if the given name is of a Ruby local variable.
isValidName
(Object
is a name to be checked.
name
)

Returns true if the given name is a decent Ruby local variable.

public void
remove()

Implements org.jruby.embed.variable.BiVariable.remove.

Attempts to remove this variable from top self or receiver.

public static void
retrieve(RubyObject
receiver object returned when a script is evaluated.
receiver
,
BiVariableMap
map to save retrieved local variables.
vars
)

Doesn't do anything since a transient local variable should not be retrieved from Ruby.

Inherited from org.jruby.embed.variable.AbstractVariable:
getCurrentContextgetJavaObjectgetNamegetReceivergetRubyClassgetRubyObjectgetRuntimegetTopSelfgetTopSelfisReceiverIdenticalisValidNamesetJavaObjectsetRubyObjectupdateByJavaObjectupdateRubyObject

Field Detail

VALID_NAMEback to summary
private static final String VALID_NAME

Constructor Detail

TransientLocalVariableback to summary
private TransientLocalVariable(RubyObject receiver, String name, Object... javaObjects)

Method Detail

getInstanceback to summary
public static BiVariable getInstance(RubyObject receiver, String name, Object... javaObject)

Returns an instance of this class. This factory method is used when a transient local variable is put in BiVariableMap.

Parameters
receiver:RubyObject

receiver object returned when a script is evaluated.

name:String

a variable name

javaObject:Object[]

Java object that should be assigned to.

Returns:BiVariable

the instance of TransientLocalVariable

getTypeback to summary
public BiVariable.Type getType()

Implements org.jruby.embed.variable.BiVariable.getType.

Returns enum type of this variable defined in BiVariable.

Returns:BiVariable.Type

this enum type, BiVariable.Type.LocalVariable.

Annotations
@Override
injectback to summary
public void inject()

Implements org.jruby.embed.variable.BiVariable.inject.

Injects a local variable value to a parsed Ruby script. This method is invoked during EvalUnit#run() is executed.

Annotations
@Override
isValidNameback to summary
public static boolean isValidName(Object name)

Returns true if the given name is a decent Ruby local variable. Unless returns false.

Parameters
name:Object

is a name to be checked.

Returns:boolean

true if the given name is of a Ruby local variable.

removeback to summary
public void remove()

Implements org.jruby.embed.variable.BiVariable.remove.

Attempts to remove this variable from top self or receiver.

Annotations
@Override
retrieveback to summary
public static void retrieve(RubyObject receiver, BiVariableMap vars)

Doesn't do anything since a transient local variable should not be retrieved from Ruby.

Parameters
receiver:RubyObject

receiver object returned when a script is evaluated.

vars:BiVariableMap

map to save retrieved local variables.