Package org.jruby

Examples of org.jruby.RubyString$EmptyByteListHolder


    protected LoadServiceResource tryResourceFromHome(SearchState state, String baseName, SuffixType suffixType) throws RaiseException {
        LoadServiceResource foundResource = null;

        RubyHash env = (RubyHash) runtime.getObject().fastGetConstant("ENV");
        RubyString env_home = runtime.newString("HOME");
        if (env.has_key_p(env_home).isFalse()) {
            return null;
        }
        String home = env.op_aref(runtime.getCurrentContext(), env_home).toString();
        String path = baseName.substring(2);
View Full Code Here


        }
       
        Outer: for (int i = 0; i < loadPath.size(); i++) {
            // TODO this is really inefficient, and potentially a problem everytime anyone require's something.
            // we should try to make LoadPath a special array object.
            RubyString entryString = loadPath.eltInternal(i).convertToString();
            String loadPathEntry = entryString.asJavaString();

            if (loadPathEntry.equals(".") || loadPathEntry.equals("")) {
                foundResource = tryResourceFromCWD(state, baseName, suffixType);

                if (foundResource != null) {
View Full Code Here

        }

        for (int i = 0; i < loadPath.size(); i++) {
            // TODO this is really inefficient, and potentially a problem everytime anyone require's something.
            // we should try to make LoadPath a special array object.
            RubyString entryString = loadPath.eltInternal(i).convertToString();
            String entry = entryString.asJavaString();

            // if entry is an empty string, skip it
            if (entry.length() == 0) continue;

            // if entry starts with a slash, skip it since classloader resources never start with a /
View Full Code Here

        }

        protected void trySearch(String file, SuffixType suffixType) throws AlreadyLoaded {
            for (String suffix : suffixType.getSuffixes()) {
                String searchName = file + suffix;
                RubyString searchNameString = RubyString.newString(runtime, searchName);
                if (featureAlreadyLoaded(searchNameString)) {
                    throw new AlreadyLoaded(searchNameString);
                }
            }
        }
View Full Code Here

    private IRubyObject userUnmarshal(MarshalState state) throws IOException {
        String className = unmarshalObject(false).asJavaString();
        ByteList marshaled = unmarshalString();
        RubyClass classInstance = findClass(className);
        RubyString data = RubyString.newString(getRuntime(), marshaled);
        if (state.isIvarWaiting()) {
            defaultVariablesUnmarshal(data);
            state.setIvarWaiting(false);
        }
        IRubyObject unmarshaled = classInstance.smartLoadOldUser(data);
View Full Code Here

        }
       
        if (!(dumpResult instanceof RubyString)) {
            throw runtime.newTypeError(dumpResult, runtime.getString());
        }
        RubyString marshaled = (RubyString)dumpResult;

        boolean hasVars;
        if (hasVars = marshaled.hasVariables()) {
            write(TYPE_IVAR);
        }

        write(TYPE_USERDEF);
        RubyClass metaclass = value.getMetaClass().getRealClass();

        writeAndRegisterSymbol(metaclass.getName());

        writeString(marshaled.getByteList());

        if (hasVars) {
            dumpVariables(marshaled.getVariableList());
        }
    }
View Full Code Here

       
        return result;
    }
   
    private static void addBackTraceElement(Ruby runtime, RubyArray backtrace, RubyStackTraceElement element) {
        RubyString str = RubyString.newString(runtime, element.getFileName() + ":" + element.getLineNumber() + ":in `" + element.getMethodName() + "'");
        backtrace.append(str);
    }
View Full Code Here

        RubyArray traceArray = RubyArray.newArray(runtime);

        for (int i = 0; i < trace.length; i++) {
            RubyStackTraceElement element = trace[i];

            RubyString str = RubyString.newString(runtime, element.getFileName() + ":" + element.getLineNumber() + ":in `" + element.getMethodName() + "'");
            traceArray.append(str);
        }

        return traceArray;
    }
View Full Code Here

   * @param text
   */
  public static void setString(IRubyObject irb, String text) {
    // is string?
    if (irb instanceof RubyString) {
      RubyString rs = (RubyString) irb;
      rs.clear();
      rs.append(RubyString.newString(irb.getRuntime(), text));
    } else {
      throw new IllegalArgumentException(irb + " is not a String");
    }

  }
View Full Code Here

//    }

    public void testSingleArgumentCommandOnWindowsIsOnlyRunByShellIfCommandContainsSpaces() {
        if (Platform.IS_WINDOWS) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            RubyString cmd = RubyString.newString(runtime, "nonexistentcmd");
            try {
                ShellLauncher.runAndWait(runtime, new IRubyObject[]{cmd}, baos);
                fail("should have raised an exception");
            } catch (RaiseException re) {
            }
View Full Code Here

TOP

Related Classes of org.jruby.RubyString$EmptyByteListHolder

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.