Package org.jruby.embed.variable
Class Argv
java.lang.Object
org.jruby.embed.variable.Argv
- All Implemented Interfaces:
BiVariable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jruby.embed.variable.BiVariable
BiVariable.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Objectprotected Classprotected final Stringprotected final IRubyObjectprotected IRubyObject -
Method Summary
Modifier and TypeMethodDescriptionstatic BiVariablegetInstance(RubyObject receiver, String name, Object... javaObject) Returns an instance of this class.Returns a value of the variable this object holds in Java type.getName()Returns a name of the variable this object holds.Returns the original receiver where this variable has been retrieved.protected static RubyModulegetRubyClass(Ruby runtime) Returns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type.getType()Returns enum type of this variable defined inBiVariable.voidinject()Injects ARGV values to a parsed Ruby script.booleanisReceiverIdentical(RubyObject receiver) Returns true if a given receiver is identical to the receiver this object has.static booleanisValidName(Object name) Returns true if the given name is ARGV.protected static booleanisValidName(String pattern, Object name) voidremove()Removes this object fromBiVariableMap.static voidretrieve(RubyObject receiver, BiVariableMap vars) Retrieves ARGV from Ruby after the evaluation or method invocation.static voidretrieveByKey(RubyObject receiver, BiVariableMap vars, String key) Retrieves ARGV by key from Ruby runtime after the evaluation.voidsetJavaObject(Ruby runtime, Object javaObject) Sets a Java object as a value of this object.voidsetRubyObject(IRubyObject rubyObject) Sets a org.jruby.runtime.builtin.IRubyObject type, Ruby object as a value of this object.protected voidupdateByJavaObject(Ruby runtime, Object... values) protected voidupdateRubyObject(IRubyObject rubyObject)
-
Field Details
-
receiver
-
name
-
javaObject
-
javaType
-
rubyObject
-
fromRuby
protected volatile boolean fromRuby
-
-
Method Details
-
getInstance
Returns an instance of this class. This factory method is used when an ARGV is put inBiVariableMap.- Parameters:
receiver- Receiver object returned when a script is evaluated.name- a variable namejavaObject- Java object that should be assigned to.- Returns:
- the instance of Constant
-
getType
Returns enum type of this variable defined inBiVariable.- Returns:
- this enum type, BiVariable.Type.InstanceVariable.
-
isValidName
Returns true if the given name is ARGV. Unless returns false.- Parameters:
name- is a name to be checked.- Returns:
- true if the given name is ARGV.
-
inject
public void inject()Injects ARGV values to a parsed Ruby script. This method is invoked during EvalUnit#run() is executed. -
remove
public void remove()Removes this object fromBiVariableMap. Also, initialize this variable in top self. -
retrieve
Retrieves ARGV from Ruby after the evaluation or method invocation.- Parameters:
receiver- receiver object returned when a script is evaluated.vars- map to save retrieved constants.
-
updateRubyObject
-
retrieveByKey
Retrieves ARGV by key from Ruby runtime after the evaluation. This method is used when eager retrieval is off.- Parameters:
receiver- receiver object returned when a script is evaluated.vars- map to save retrieved instance variables.key- instace varible name
-
getJavaObject
Description copied from interface:BiVariableReturns a value of the variable this object holds in Java type.- Specified by:
getJavaObjectin interfaceBiVariable- Returns:
- a value in Java type.
-
updateByJavaObject
-
getReceiver
Description copied from interface:BiVariableReturns the original receiver where this variable has been retrieved.- Specified by:
getReceiverin interfaceBiVariable- Returns:
- an original receiver.
-
isReceiverIdentical
Returns true if a given receiver is identical to the receiver this object has.- Specified by:
isReceiverIdenticalin interfaceBiVariable- Returns:
- true if identical otherwise false
-
getName
Description copied from interface:BiVariableReturns a name of the variable this object holds. The name follows Ruby's naming rule.- Specified by:
getNamein interfaceBiVariable- Returns:
- a name of the variable
-
setJavaObject
Description copied from interface:BiVariableSets a Java object as a value of this object. At the same time, an equivalent Ruby object is set automatically.- Specified by:
setJavaObjectin interfaceBiVariable- Parameters:
runtime- is used to convert a Java object to Ruby object.javaObject- is a variable value to be set.
-
getRubyObject
Description copied from interface:BiVariableReturns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type.- Specified by:
getRubyObjectin interfaceBiVariable- Returns:
- a value in IRubyObject type.
-
setRubyObject
Description copied from interface:BiVariableSets a org.jruby.runtime.builtin.IRubyObject type, Ruby object as a value of this object. At the same time, an equivalent Java object is set automatically.- Specified by:
setRubyObjectin interfaceBiVariable- Parameters:
rubyObject- is a variable value to be set.
-
getRubyClass
-
isValidName
-