/** * Injects variable values from Java to Ruby just before an evaluation or * method invocation. * * @param map a variable map that has name-value pairs to be injected * @param runtime Ruby runtime * @param scope scope to inject local variable values * @param depth depth of a frame to inject local variable values * @param receiver a receiver when the script has been evaluated once */ public static void inject(BiVariableMap map, Ruby runtime, ManyVarsDynamicScope scope, int depth, IRubyObject receiver) { // lvar might not be given while parsing but be given when evaluating. // to avoid ArrayIndexOutOfBoundsException, checks the length of scope.getValues() if (scope != null && scope.getValues().length > 0) { IRubyObject[] values4Injection = map.getLocalVarValues(); if (values4Injection != null && values4Injection.length > 0) { for (int i = 0; i < values4Injection.length; i++) { scope.setValue(i, values4Injection[i], depth); } } } List<BiVariable> variables = map.getVariables(); if (variables == null) return; for (int i=0; i<variables.size(); i++) { variables.get(i).inject(); } }
/** * Injects variable values from Java to Ruby just before an evaluation or * method invocation. * * @param map a variable map that has name-value pairs to be injected * @param runtime Ruby runtime * @param scope scope to inject local variable values * @param depth depth of a frame to inject local variable values * @param receiver a receiver when the script has been evaluated once */ public static void inject(BiVariableMap map, Ruby runtime, ManyVarsDynamicScope scope, int depth, IRubyObject receiver) { // lvar might not be given while parsing but be given when evaluating. // to avoid ArrayIndexOutOfBoundsException, checks the length of scope.getValues() if (scope != null && scope.getValues().length > 0) { IRubyObject[] values4Injection = map.getLocalVarValues(); if (values4Injection != null && values4Injection.length > 0) { for (int i = 0; i < values4Injection.length; i++) { scope.setValue(i, values4Injection[i], depth); } } } List<BiVariable> variables = map.getVariables(); if (variables == null) return; for (int i=0; i<variables.size(); i++) { variables.get(i).inject(); } }
/** * Injects variable values from Java to Ruby just before an evaluation or * method invocation. * * @param map a variable map that has name-value pairs to be injected * @param runtime Ruby runtime * @param scope scope to inject local variable values * @param depth depth of a frame to inject local variable values * @param receiver a receiver when the script has been evaluated once */ public static void inject(BiVariableMap map, Ruby runtime, ManyVarsDynamicScope scope, int depth, IRubyObject receiver) { // lvar might not be given while parsing but be given when evaluating. // to avoid ArrayIndexOutOfBoundsException, checks the length of scope.getValues() if (scope != null && scope.getValues().length > 0) { IRubyObject[] values4Injection = map.getLocalVarValues(); if (values4Injection != null && values4Injection.length > 0) { for (int i = 0; i < values4Injection.length; i++) { scope.setValue(i, values4Injection[i], depth); } } } Collection<BiVariable> variables = map.getVariables(); for ( final BiVariable var : variables ) var.inject(); }
/** * Injects variable values from Java to Ruby just before an evaluation or * method invocation. * * @param map a variable map that has name-value pairs to be injected * @param runtime Ruby runtime * @param scope scope to inject local variable values * @param depth depth of a frame to inject local variable values * @param receiver a receiver when the script has been evaluated once */ public static void inject(BiVariableMap map, Ruby runtime, ManyVarsDynamicScope scope, int depth, IRubyObject receiver) { // lvar might not be given while parsing but be given when evaluating. // to avoid ArrayIndexOutOfBoundsException, checks the length of scope.getValues() if (scope != null && scope.getValues().length > 0) { IRubyObject[] values4Injection = map.getLocalVarValues(); if (values4Injection != null && values4Injection.length > 0) { for (int i = 0; i < values4Injection.length; i++) { scope.setValue(i, values4Injection[i], depth); } } } Collection<BiVariable> variables = map.getVariables(); for ( final BiVariable var : variables ) var.inject(); }