public class VariableInterceptor extends Object
Constructor and Description |
---|
VariableInterceptor() |
Modifier and Type | Method and Description |
---|---|
static BiVariable |
getVariableInstance(LocalVariableBehavior behavior,
RubyObject receiver,
String name,
Object... value)
Returns an appropriate type of a variable instance to the specified local
variable behavior.
|
static void |
inject(BiVariableMap map,
Ruby runtime,
ManyVarsDynamicScope scope,
int depth,
IRubyObject receiver)
Injects variable values from Java to Ruby just before an evaluation or
method invocation.
|
static boolean |
isKindOfRubyVariable(LocalVariableBehavior behavior,
String name)
Checks the given name is whether a legal Ruby variable/constant name or not.
|
static void |
retrieve(LocalVariableBehavior behavior,
BiVariableMap map,
RubyObject receiver)
Retrieves variable/constant names and values after the evaluation or method
invocation.
|
static void |
terminateGlobalVariables(LocalVariableBehavior behavior,
Collection<BiVariable> variables,
Ruby runtime)
Clears global variable values from Ruby runtime to behave the same as
JSR 223 reference implementation.
|
static void |
terminateLocalVariables(LocalVariableBehavior behavior,
List<String> varNames,
List<BiVariable> variables)
Clears local variables form the variable map so that old local variable
name-value pairs are not to be used in successive evaluations.
|
static void |
tryLazyRetrieval(LocalVariableBehavior behavior,
BiVariableMap map,
IRubyObject receiver,
Object key)
Retrieves specified variable/constant name and value after the evaluation
or method invocation only when it is requested.
|
public static BiVariable getVariableInstance(LocalVariableBehavior behavior, RubyObject receiver, String name, Object... value)
runtime
- Ruby runtimename
- variable namevalue
- variable valuepublic static void inject(BiVariableMap map, Ruby runtime, ManyVarsDynamicScope scope, int depth, IRubyObject receiver)
map
- a variable map that has name-value pairs to be injectedruntime
- Ruby runtimescope
- scope to inject local variable valuesdepth
- depth of a frame to inject local variable valuesreceiver
- a receiver when the script has been evaluated oncepublic static void retrieve(LocalVariableBehavior behavior, BiVariableMap map, RubyObject receiver)
map
- variable map that holds retrieved name-value pairs.runtime
- Ruby runtimereceiver
- a receiver when the script has been evaluated oncepublic static void tryLazyRetrieval(LocalVariableBehavior behavior, BiVariableMap map, IRubyObject receiver, Object key)
map
- variable map that holds retrieved name-value pairs.runtime
- Ruby runtimereceiver
- a receiver when the script has been evaluated oncepublic static void terminateGlobalVariables(LocalVariableBehavior behavior, Collection<BiVariable> variables, Ruby runtime)
variables
- a variable list to be cleared from Ruby runtimeruntime
- Ruby runtimepublic static void terminateLocalVariables(LocalVariableBehavior behavior, List<String> varNames, List<BiVariable> variables)
varNames
- variable name list to be clearedvariables
- variable value list to be clearedpublic static boolean isKindOfRubyVariable(LocalVariableBehavior behavior, String name)
name
- a given name to be checkedCopyright © 2001-2015 JRuby. All Rights Reserved.