Package org.jruby

Examples of org.jruby.RubyFixnum


      try {
        int offset = (int) ((RubyFixnum) _offset).getLongValue();
        int fd = (int) ((RubyFixnum) _fd).getLongValue();
        int whence = (int) ((RubyFixnum) _whence).getLongValue();
        int where = postgresqlConnection.getLargeObjectAPI().loSeek(fd, offset, whence);
        return new RubyFixnum(context.runtime, where);
      } catch (IOException e) {
        throw newPgError(context, "lo_lseek failed: " + e.getLocalizedMessage(), null, getClientEncodingAsJavaEncoding(context));
      } catch (PostgresqlException e) {
        throw newPgError(context, "lo_lseek failed: " + e.getLocalizedMessage(), e.getResultSet(), getClientEncodingAsJavaEncoding(context));
      }
View Full Code Here


        for (ResultStatus status : ResultStatus.values())
          pgConstants.defineConstant(status.name(), ruby.newFixnum(status.ordinal()));

        // create the large object constants
        pgConstants.defineConstant("INV_READ", new RubyFixnum(ruby, LargeObjectAPI.READ));
        pgConstants.defineConstant("INV_WRITE", new RubyFixnum(ruby, LargeObjectAPI.WRITE));
        pgConstants.defineConstant("SEEK_SET", new RubyFixnum(ruby, LargeObjectAPI.SEEK_SET));
        pgConstants.defineConstant("SEEK_END", new RubyFixnum(ruby, LargeObjectAPI.SEEK_END));
        pgConstants.defineConstant("SEEK_CUR", new RubyFixnum(ruby, LargeObjectAPI.SEEK_CUR));

        // create error fields objects
        for (ErrorField field : ErrorResponse.ErrorField.values())
          pgConstants.defineConstant(field.name(), ruby.newFixnum(field.getCode()));
View Full Code Here

        } catch (JumpException je) {
            if (je.getJumpType() == JumpException.JumpType.RaiseJump) {
                RubyException raisedException = ((RaiseException)je).getException();

                if (raisedException.isKindOf(runtime.getClass("SystemExit"))) {
                    RubyFixnum status = (RubyFixnum)raisedException.getInstanceVariable("status");

                    if (status != null) {
                        System.exit(RubyNumeric.fix2int(status));
                    }
                } else {
View Full Code Here

    } else if (method instanceof ProcMethod) {
      RubyProc proc = (RubyProc)getPrivateField(runtime, ProcMethod.class, "proc", method);
      String file = (String)getPrivateField(runtime, RubyProc.class, "file", proc);
      int line = getPrivateIntField(runtime, RubyProc.class, "line", proc);
      RubyString rubyFile = runtime.newString(file);
      RubyFixnum rubyLine = runtime.newFixnum(line + 1);
      return runtime.newArray(rubyFile, rubyLine);
    } else if (method instanceof AliasMethod) {
      method = method.getRealMethod();
      return methodSourceLocation(runtime, method);
    } else if (method instanceof MethodMethod) {
View Full Code Here

        }
        return RubyArray.newArray(document.getRuntime());
    }

    private boolean isErrorIncreased(RubyArray baseErrors, RubyArray createdErrors) {
        RubyFixnum length = ((RubyArray)createdErrors.op_diff(baseErrors)).length();
        int diff_in_length = (Integer)length.toJava(Integer.class);
        return diff_in_length > 0;
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyFixnum

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.