globals.alias("$LAST_PAREN_MATCH", "$+");
}
private static void defineGlobalEnvConstants(Ruby runtime) {
Map environmentVariableMap = null;
OSEnvironment environment = new OSEnvironment();
environmentVariableMap = environment.getEnvironmentVariableMap(runtime);
if (environmentVariableMap == null) {
// if the environment variables can't be obtained, define an empty ENV
environmentVariableMap = new HashMap();
}
CaseInsensitiveStringOnlyRubyHash env = new CaseInsensitiveStringOnlyRubyHash(runtime,
environmentVariableMap,
runtime.getNil(),
runtime.getInstanceConfig().isNativeEnabled() &&
runtime.getInstanceConfig().isUpdateNativeENVEnabled() );
env.getSingletonClass().defineAnnotatedMethods(CaseInsensitiveStringOnlyRubyHash.class);
runtime.defineGlobalConstant("ENV", env);
runtime.setENV(env);
// Define System.getProperties() in ENV_JAVA
Map systemProps = environment.getSystemPropertiesMap(runtime);
RubyHash systemPropsHash = new ReadOnlySystemPropertiesHash(
runtime, systemProps, runtime.getNil());
systemPropsHash.setFrozen(true);
runtime.defineGlobalConstant("ENV_JAVA", systemPropsHash);
}