Package org.jruby

Examples of org.jruby.RubySymbol$SymbolTable$SymbolEntry


        if (query instanceof RubySymbol) {
            IRubyObject value = kv_map.fastARef(query);
            return value != null ? value : context.runtime.getNil();

        } else if (query instanceof RubyInteger) {
            RubySymbol symbol = valueToSymbol.get((int) ((RubyInteger) query).getLongValue());
            return symbol != null ? symbol : context.runtime.getNil();

        } else {
            return context.runtime.getNil();
        }
View Full Code Here


    }

    @JRubyMethod(name = "from_native")
    public final IRubyObject from_native(ThreadContext context, IRubyObject value, IRubyObject ctx) {

        RubySymbol sym;

        if (value instanceof RubyInteger && (sym = valueToSymbol.get((int) ((RubyInteger) value).getLongValue())) != null) {
            return sym;
        }
View Full Code Here

        resultFormat = ((RubyFixnum) args[2]).getLongValue() == 1 ? Format.Binary : Format.Text;
      return resultFormat;
    }

    private void fillValuesAndFormat(ThreadContext context, RubyArray params, Value[] values, int [] oids) {
      RubySymbol value_s = context.runtime.newSymbol("value");
      RubySymbol type_s = context.runtime.newSymbol("type");
      RubySymbol format_s = context.runtime.newSymbol("format");
      for (int i = 0; i < params.getLength(); i++) {
        IRubyObject param = params.entry(i);
        Format valueFormat = Format.Text;
        if (param.isNil()) {
          values[i] = new Value(null, valueFormat);
View Full Code Here

      NotificationResponse notification = postgresqlConnection.notifications();
      if (notification == null)
        return context.nil;
      RubyHash hash = new RubyHash(context.runtime);

      RubySymbol relname = context.runtime.newSymbol("relname");
      RubySymbol pid = context.runtime.newSymbol("be_pid");
      RubySymbol extra = context.runtime.newSymbol("extra");

      hash.op_aset(context, relname, context.runtime.newString(notification.getCondition()));
      hash.op_aset(context, pid, context.runtime.newFixnum(notification.getPid()));
      hash.op_aset(context, extra, context.runtime.newString(notification.getPayload()));
View Full Code Here

    public final IRubyObject getConfig() { return this.config; }

    protected final IRubyObject getConfigValue(final ThreadContext context, final String key) {
        final IRubyObject config = getConfig();
        final RubySymbol keySym = context.runtime.newSymbol(key);
        if ( config instanceof RubyHash ) {
            return ((RubyHash) config).op_aref(context, keySym);
        }
        return config.callMethod(context, "[]", keySym);
    }
View Full Code Here

    }

    protected final IRubyObject setConfigValue(final ThreadContext context,
            final String key, final IRubyObject value) {
        final IRubyObject config = getConfig();
        final RubySymbol keySym = context.runtime.newSymbol(key);
        if ( config instanceof RubyHash ) {
            return ((RubyHash) config).op_aset(context, keySym, value);
        }
        return config.callMethod(context, "[]=", new IRubyObject[] { keySym, value });
    }
View Full Code Here

    }

    protected final IRubyObject setConfigValueIfNotSet(final ThreadContext context,
            final String key, final IRubyObject value) {
        final IRubyObject config = getConfig();
        final RubySymbol keySym = context.runtime.newSymbol(key);
        if ( config instanceof RubyHash ) {
            final IRubyObject setValue = ((RubyHash) config).op_aref(context, keySym);
            if ( ! setValue.isNil() ) return setValue;
            return ((RubyHash) config).op_aset(context, keySym, value);
        }
View Full Code Here

            // `column.type` contains the base type while there's `column.array?`
            if ( column.respondsTo("array?") && column.callMethod(context, "array?").isTrue() ) {
                internedType = "array";
            }
            else {
                final RubySymbol columnType = resolveColumnType(context, runtime, column);
                internedType = columnType.asJavaString();
            }
        }
        else {
            if ( value instanceof RubyInteger ) {
                internedType = "integer";
View Full Code Here

TOP

Related Classes of org.jruby.RubySymbol$SymbolTable$SymbolEntry

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.