Package org.zkoss.zk.scripting.jruby
Class JRubyInterpreter
- java.lang.Object
-
- org.zkoss.zk.scripting.util.GenericInterpreter
-
- org.zkoss.zk.scripting.jruby.JRubyInterpreter
-
- All Implemented Interfaces:
Interpreter
public class JRubyInterpreter extends GenericInterpreter
JRuby interpreter.- Author:
- tomyeh
-
-
Field Summary
-
Fields inherited from class org.zkoss.zk.scripting.util.GenericInterpreter
UNDEFINED
-
-
Constructor Summary
Constructors Constructor Description JRubyInterpreter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancontains(java.lang.String name)Tests whether a variable is defined in this interpreter.voiddestroy()Reset the owner (GenericInterpreter.getOwner()) to null.protected voidexec(java.lang.String script)Executes the specified script.protected java.lang.Objectget(java.lang.String name)Gets the variable from the interpreter.java.lang.ObjectgetNativeInterpreter()Returns the native interpreter, or null if it is not initialized or destroyed.voidinit(Page owner, java.lang.String zslang)Initializes the interpreter.protected voidset(java.lang.String name, java.lang.Object value)Sets the variable to the interpreter.protected voidunset(java.lang.String name)Removes the variable from the interpreter.-
Methods inherited from class org.zkoss.zk.scripting.util.GenericInterpreter
afterExec, afterInterpret, beforeExec, beforeInterpret, contains, containsVariable, containsVariable, get, getClass, getCurrent, getFromNamespace, getFromNamespace, getFunction, getFunction, getImplicit, getLanguage, getOwner, getVariable, getVariable, interpret, set, setVariable, setVariable, unset, unsetVariable, unsetVariable
-
-
-
-
Method Detail
-
getNativeInterpreter
public java.lang.Object getNativeInterpreter()
Returns the native interpreter, or null if it is not initialized or destroyed. From application's standpoint, it never returns null, and the returned object must be an instance ofRuby- Since:
- 3.0.2
-
exec
protected void exec(java.lang.String script)
Description copied from class:GenericInterpreterExecutes the specified script. Deriving class shall provide an implementation of this method, rather than overridingGenericInterpreter.interpret(java.lang.String, org.zkoss.zk.ui.ext.Scope).- Specified by:
execin classGenericInterpreter
-
contains
protected boolean contains(java.lang.String name)
Description copied from class:GenericInterpreterTests whether a variable is defined in this interpreter. Optional. Implement it if the interpreter can tell the difference between null and undefined.By default, it tests whether
GenericInterpreter.get(String)returns non-null.- Overrides:
containsin classGenericInterpreter
-
get
protected java.lang.Object get(java.lang.String name)
Description copied from class:GenericInterpreterGets the variable from the interpreter. Optional. Implement it if you want to expose variables defined in the interpreter to Java codes.GenericInterpreter.beforeExec()is called first, before this method is invoked.An empty (and fake) scope is pushed so
GenericInterpreter.getFromNamespace(java.lang.String)always returns null.- Overrides:
getin classGenericInterpreter
-
set
protected void set(java.lang.String name, java.lang.Object value)Description copied from class:GenericInterpreterSets the variable to the interpreter. Optional. Implement it if you want to allow Java codes to define a variable in the interpreter.GenericInterpreter.beforeExec()is called first, before this method is invoked.- Overrides:
setin classGenericInterpreter
-
unset
protected void unset(java.lang.String name)
Description copied from class:GenericInterpreterRemoves the variable from the interpreter. Optional. Implement it if you want to allow Java codes to undefine a variable from the interpreter.GenericInterpreter.beforeExec()is called first, before this method is invoked.- Overrides:
unsetin classGenericInterpreter
-
init
public void init(Page owner, java.lang.String zslang)
Description copied from interface:InterpreterInitializes the interpreter. It is called once when the new instance of interpreter is constructed.- Specified by:
initin interfaceInterpreter- Overrides:
initin classGenericInterpreterzslang- the language this interpreter is associated with
-
destroy
public void destroy()
Description copied from class:GenericInterpreterReset the owner (GenericInterpreter.getOwner()) to null.- Specified by:
destroyin interfaceInterpreter- Overrides:
destroyin classGenericInterpreter
-
-