Package org.jruby

Examples of org.jruby.RubyString.asJavaString()


       
        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

    }

    private String gemClasspath() {
        RubyString gemLocationRubyObject = (RubyString) evaler.eval(runtime,
                "Gem.loaded_specs['asciidoctor'].full_gem_path");
        String gemLocation = gemLocationRubyObject.asJavaString();

        return gemLocation.substring(gemLocation.indexOf("gems"), gemLocation.length());
    }
}
View Full Code Here

   
    JRubyAsciidoctor asciidoctor = (JRubyAsciidoctor) JRubyAsciidoctor.create("My_gem_path");
    IRubyObject evalScriptlet = asciidoctor.rubyRuntime.evalScriptlet("ENV['GEM_PATH']");
   
    RubyString gemPathValue = (RubyString)evalScriptlet;
    assertThat(gemPathValue.asJavaString(), is("My_gem_path"));
   
   
  }
 
}
View Full Code Here

        return foundResource;
    }
   
    protected String getLoadPathEntry(IRubyObject entry) {
        RubyString entryString = entry.convertToString();
        return entryString.asJavaString();
    }

    protected LoadServiceResource tryResourceFromJarURLWithLoadPath(String namePlusSuffix, String loadPathEntry) {
        LoadServiceResource foundResource = null;
View Full Code Here

            throw context.getRuntime().newArgumentError("Argument should be string");
        }
        RubyString ruby_string = (RubyString)arg;
        try {
            Var reader = DiametricService.getFn("clojure.core", "read-string");
            Object value = reader.invoke((String)ruby_string.asJavaString());
            RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Object");
            DiametricObject diametric_object = (DiametricObject)clazz.allocate();
            diametric_object.update(value);
            return diametric_object;
        } catch (Exception e) {
View Full Code Here

            return (Object)tmvalue.getJavaDate();
        }
        if (value instanceof RubySymbol) {
            // schema or data keyword
            RubyString edn_string = (RubyString)RuntimeHelpers.invoke(context, value, "to_s");
            return (Object)Keyword.intern((String)edn_string.asJavaString());
        }
        if (value.respondsTo("to_edn") && value.respondsTo("symbol")) {
            // EDN::Type::Symbol (query)
            RubyString edn_string = (RubyString)RuntimeHelpers.invoke(context, value, "to_edn");
            return (Object)clojure.lang.Symbol.intern((String)edn_string.asJavaString());
View Full Code Here

            return (Object)Keyword.intern((String)edn_string.asJavaString());
        }
        if (value.respondsTo("to_edn") && value.respondsTo("symbol")) {
            // EDN::Type::Symbol (query)
            RubyString edn_string = (RubyString)RuntimeHelpers.invoke(context, value, "to_edn");
            return (Object)clojure.lang.Symbol.intern((String)edn_string.asJavaString());
        }
        if (value.respondsTo("to_time")) {
            // DateTime or Date
            RubyTime tmvalue = (RubyTime)RuntimeHelpers.invoke(context, value, "to_time");
            return (Object)tmvalue.getJavaDate();
View Full Code Here

        }
        if (!(args[0] instanceof RubySymbol)) {
            throw context.getRuntime().newArgumentError("The first argument should be a Symbol");
        }
        RubyString edn_string = (RubyString)RuntimeHelpers.invoke(context, args[0], "to_s");
        Keyword partition = Keyword.intern((String)edn_string.asJavaString());
        RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Object");
        DiametricObject diametric_object = (DiametricObject)clazz.allocate();
        try {
            clojure.lang.Var clj_var = DiametricService.getFn("datomic.api", "tempid");
            if (args.length > 1 && (args[1] instanceof RubyFixnum)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.