* @param runtime Ruby runtime
* @param receiver receiver object returned when a script is evaluated.
* @param vars map to save retrieved local variables.
*/
public static void retrieve(RubyObject receiver, BiVariableMap vars) {
ManyVarsDynamicScope scope =
(ManyVarsDynamicScope) receiver.getRuntime().getCurrentContext().getCurrentScope();
if (scope == null) {
return;
}
String[] names = scope.getAllNamesInScope();
IRubyObject[] values = scope.getValues();
if (names == null || values == null || names.length == 0 || values.length == 0) {
return;
}
// Local variable is always saved as a top level variable.
for (int i=0; i<names.length; i++) {