Package org.jruby

Examples of org.jruby.RubySymbol$SymbolTable


    }

    public static void addInstanceMethod(RubyModule containingClass, String name, DynamicMethod method, Visibility visibility, ThreadContext context, Ruby runtime) {
        containingClass.addMethod(name, method);

        RubySymbol sym = runtime.fastNewSymbol(name);
        if (visibility == Visibility.MODULE_FUNCTION) {
            addModuleMethod(containingClass, name, method, context, sym);
        }

        callNormalMethodHook(containingClass, context, sym);
View Full Code Here


    }

    public void dumpDefaultObjectHeader(char tp, RubyClass type) throws IOException {
        dumpExtended(type);
        write(tp);
        RubySymbol classname = RubySymbol.newSymbol(runtime, getPathFromClass(type.getRealClass()));
        dumpObject(classname);
    }
View Full Code Here

                break;
            case 'm' :
                rubyObj = RubyModule.unmarshalFrom(this);
                break;
            case 'e':
                RubySymbol moduleName = (RubySymbol) unmarshalObject();
                RubyModule tp = null;
                try {
                    tp = runtime.getClassFromPath(moduleName.asJavaString());
                } catch (RaiseException e) {
                    if (runtime.fastGetModule("NameError").isInstance(e.getException())) {
                        throw runtime.newArgumentError("undefined class/module " + moduleName.asJavaString());
                    }
                    throw e;
                }

                rubyObj = unmarshalObject();
View Full Code Here

        }
        return (int) result;
    }

    private IRubyObject defaultObjectUnmarshal() throws IOException {
        RubySymbol className = (RubySymbol) unmarshalObject();

        RubyClass type = null;
        try {
            type = getClassFromPath(runtime, className.toString());
        } catch (RaiseException e) {
            if (runtime.fastGetModule("NameError").isInstance(e.getException())) {
                throw runtime.newArgumentError("undefined class/module " + className.asJavaString());
            }
               
            throw e;
        }
View Full Code Here

        object.syncVariables(attrs);
    }
   
   
    private IRubyObject uclassUnmarshall() throws IOException {
      RubySymbol className = (RubySymbol)unmarshalObject();
     
      RubyClass type = (RubyClass)runtime.getClassFromPath(className.asJavaString());
     
        // All "C" marshalled objects descend from core classes, which are all RubyObject
      RubyObject result = (RubyObject)unmarshalObject();
     
      result.setMetaClass(type);
View Full Code Here

    public final CallSite getCallSite(int index) {
        return callSites[index];
    }

    public final RubySymbol getSymbol(Ruby runtime, int index, String name) {
        RubySymbol symbol = symbols[index];
        if (symbol == null) return symbols[index] = runtime.newSymbol(name);
        return symbol;
    }
View Full Code Here

    public List<Node> childNodes() {
        return EMPTY_LIST;
    }

    public RubySymbol getSymbol(Ruby runtime) {
        RubySymbol sym;
        if ((sym = symbol) != null) return sym;
        return symbol = runtime.fastNewSymbol(name);
    }
View Full Code Here

    char[] data = input.toCharArray();
    String disposable_string;

    String name = "";
    String prefix = "";
    RubySymbol flavor = RubySymbol.newSymbol(runtime, "tasteless".intern());
    RubyHash attributes = RubyHash.newHash(runtime);

    int tagstart = 0;
    int mark_pfx = 0;
    int mark_stg = 0;
View Full Code Here

    // aborted: VM wurde (hart) abgebrochen
    // poweroff: VM ist vorhanden aber runtergefahren
    // running: VM läuft
    // saved: VM wurde pausiert
    try {
      RubySymbol symbol = (RubySymbol) vagrantVm.callMethod("state");
      return symbol.asJavaString();
    } catch (RaiseException exception) {
      throw new VagrantException(exception);
    }
  }
View Full Code Here

    public void testSymbolTable() throws Exception {
        RubySymbol.SymbolTable st = runtime.getSymbolTable();

        assertNull(st.lookup("somename"));
       
        RubySymbol symbol = RubySymbol.newSymbol(runtime, "somename");
        assertSame(symbol, st.lookup("somename"));
        assertSame(symbol, st.getSymbol("somename"));
        assertSame(symbol, st.fastGetSymbol("somename"));
       
        RubySymbol another = st.fastGetSymbol("another_name");
        assertSame(another, st.lookup("another_name"));
        assertSame(another, st.getSymbol("another_name"));
        assertSame(another, st.fastGetSymbol("another_name"));
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubySymbol$SymbolTable

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.