Package org.jruby.embed.variable
Class Argv
java.lang.Object
org.jruby.embed.variable.AbstractVariable
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
FieldsFields inherited from class org.jruby.embed.variable.AbstractVariable
fromRuby, javaObject, javaType, name, receiver, rubyObject -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateArgv(RubyObject receiver, String name, Object... javaObjects) (package private)Argv(RubyObject receiver, String name, IRubyObject irubyObject) A constructor used when ARGV is retrieved from Ruby. -
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.getType()Returns enum type of this variable defined inBiVariable.voidinject()Injects ARGV values to a parsed Ruby script.static booleanisValidName(Object name) Returns true if the given name is ARGV.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.private static voidupdateARGV(IRubyObject receiver, BiVariableMap vars) protected voidupdateRubyObject(IRubyObject rubyObject) Methods inherited from class org.jruby.embed.variable.AbstractVariable
getCurrentContext, getName, getReceiver, getRubyClass, getRubyObject, getRuntime, getTopSelf, getTopSelf, isReceiverIdentical, isValidName, setJavaObject, setRubyObject, updateByJavaObject
-
Field Details
-
VALID_NAME
- See Also:
-
-
Constructor Details
-
Argv
-
Argv
Argv(RubyObject receiver, String name, IRubyObject irubyObject) A constructor used when ARGV is retrieved from Ruby.- Parameters:
receiver- a receiver object that this variable/constant is originally in. When the variable/constant is originated from Ruby, receiver may not be null.name- the constant nameirubyObject- Ruby constant object
-
-
Method Details
-
getInstance
Returns an instance of this class. This factory method is used when an ARGV is put inBiVariableMap.- Parameters:
runtime-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.- Parameters:
runtime- is environment where a variable injection occursreceiver- is the instance that will have variable injection.
-
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:
runtime- Ruby runtimereceiver- receiver object returned when a script is evaluated.vars- map to save retrieved constants.
-
updateARGV
-
updateRubyObject
- Overrides:
updateRubyObjectin classAbstractVariable
-
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- Overrides:
getJavaObjectin classAbstractVariable- Returns:
- a value in Java type.
-