Package org.jruby.util

Examples of org.jruby.util.OSEnvironment


        RubyArgsFile.initArgsFile(runtime);
    }

    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 h1 = new CaseInsensitiveStringOnlyRubyHash(runtime,
                                                       environmentVariableMap, runtime.getNil());
        h1.getSingletonClass().defineAnnotatedMethods(CaseInsensitiveStringOnlyRubyHash.class);
        runtime.defineGlobalConstant("ENV", h1);
        runtime.setENV(h1);

        // Define System.getProperties() in ENV_JAVA
        Map systemProps = environment.getSystemPropertiesMap(runtime);
        runtime.defineGlobalConstant("ENV_JAVA", new StringOnlyRubyHash(
                runtime, systemProps, runtime.getNil()));
    }
View Full Code Here


        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);
    }
View Full Code Here

        }
    }

    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);
    }
View Full Code Here

TOP

Related Classes of org.jruby.util.OSEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.