public RubyBigDecimal(Ruby runtime, BigDecimal value) { super(runtime, runtime.getClass("BigDecimal")); this.isNaN = false; this.infinitySign = 0; this.zeroSign = 0; this.value = value; }
public RubyBigDecimal(Ruby runtime, BigDecimal value, boolean isNan) { super(runtime, runtime.getClass("BigDecimal")); this.isNaN = isNan; this.infinitySign = 0; this.zeroSign = 0; this.value = value; }
public RubyClass getArrayJavaProxyCreatorClass() { RubyClass clazz; if ((clazz = arrayJavaProxyCreatorClass) != null) return clazz; return arrayJavaProxyCreatorClass = runtime.getClass("ArrayJavaProxyCreator"); }
public static RuntimeException sockerr_with_trace(Ruby runtime, String msg, StackTraceElement[] trace) { String eol = System.getProperty("line.separator"); StringBuilder sb = new StringBuilder(); sb.append(msg); for (int i = 0, il = trace.length; i < il; i++) { sb.append(eol).append(trace[i].toString()); } return RaiseException.from(runtime, runtime.getClass("SocketError"), sb.toString()); }
@Override protected IRubyObject addrFor(ThreadContext context, InetSocketAddress addr, boolean reverse) { final Ruby runtime = context.runtime; return new Addrinfo(runtime, runtime.getClass("Addrinfo"), addr.getAddress(), addr.getPort(), Sock.SOCK_DGRAM); }
@Deprecated public RaiseException newIllegalSequence(String message) { return newRaiseException(getClass("Iconv").getClass("IllegalSequence"), message); }
private static boolean isOverflowExceptionMode(Ruby runtime) { RubyFixnum currentExceptionMode = (RubyFixnum)runtime.getClass("BigDecimal") .searchInternalModuleVariable("vpExceptionMode"); RubyFixnum EXCEPTION_OVERFLOW = (RubyFixnum)runtime.getClass("BigDecimal") .getConstant("EXCEPTION_OVERFLOW"); return (currentExceptionMode.getLongValue() & EXCEPTION_OVERFLOW.getLongValue()) != 0; }
public static RubyClass createNameErrorMessageClass(Ruby runtime, RubyClass nameErrorClass) { RubyClass messageClass = nameErrorClass.defineClassUnder("Message", runtime.getClass("Data"), RubyNameErrorMessage.NAMEERRORMESSAGE_ALLOCATOR); messageClass.defineAnnotatedMethods(RubyNameErrorMessage.class); return messageClass; }
public void load(Ruby runtime, boolean wrap) { assert !runtime.is1_8() : "the native delegator extension is not compatible with 1.8"; RubyClass delegateClass = runtime.getClass("Delegator"); delegateClass.defineAnnotatedMethods(NativeDelegateLibrary.class); }
@JRubyMethod(name = "BigDecimal", module = true, visibility = Visibility.PRIVATE) // required = 1, optional = 1 public static IRubyObject newBigDecimal(ThreadContext context, IRubyObject recv, IRubyObject arg) { return newInstance(context, context.runtime.getClass("BigDecimal"), arg); }
@JRubyMethod(name = "BigDecimal", module = true, visibility = Visibility.PRIVATE) // required = 1, optional = 1 public static IRubyObject newBigDecimal(ThreadContext context, IRubyObject recv, IRubyObject arg0, IRubyObject arg1) { return newInstance(context, context.runtime.getClass("BigDecimal"), arg0, arg1); } }
static RubyClass define(Ruby runtime, RubyClass NameError) { RubyClass Message = NameError.defineClassUnder("Message", runtime.getClass("Data"), ALLOCATOR); NameError.setConstantVisibility(runtime, "Message", true); Message.defineAnnotatedMethods(RubyNameErrorMessage.class); return Message; }
public static void createOption(Ruby runtime) { RubyClass addrinfo = runtime.getClass("Socket").defineClassUnder( "Option", runtime.getObject(), new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klazz) { return new Option(runtime, klazz); } }); addrinfo.defineAnnotatedMethods(Option.class); }
public static void createOption(Ruby runtime) { RubyClass addrinfo = runtime.getClass("Socket").defineClassUnder( "Option", runtime.getObject(), new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klazz) { return new Option(runtime, klazz); } }); addrinfo.defineAnnotatedMethods(Option.class); }
@Override public Object retrieve(ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) { StaticScope staticScope = scope.getStaticScope(); return staticScope != null ? staticScope.getModule() : context.runtime.getClass(scope.getName()); }
static void createTCPSocket(Ruby runtime) { RubyClass rb_cTCPSocket = runtime.defineClass("TCPSocket", runtime.getClass("IPSocket"), TCPSOCKET_ALLOCATOR); rb_cTCPSocket.defineAnnotatedMethods(RubyTCPSocket.class); runtime.getObject().setConstant("TCPsocket",rb_cTCPSocket); }
static void createUNIXSocket(Ruby runtime) { RubyClass rb_cUNIXSocket = runtime.defineClass("UNIXSocket", runtime.getClass("BasicSocket"), UNIXSOCKET_ALLOCATOR); runtime.getObject().setConstant("UNIXsocket", rb_cUNIXSocket); rb_cUNIXSocket.defineAnnotatedMethods(RubyUNIXSocket.class); }
@JRubyMethod(name = "puts", rest = true) public IRubyObject puts(ThreadContext context, IRubyObject[] args) { final RubyClass StringIO = context.runtime.getClass("StringIO"); StringIO sio = (StringIO) StringIO.newInstance(context, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK); sio.puts(context, args); write(sio.string(context)); return context.nil; }
@JRubyMethod public IRubyObject local_address(ThreadContext context) { Ruby runtime = context.runtime; InetSocketAddress address = getInetSocketAddress(); if (address != null) { SocketType socketType = SocketType.forChannel(getChannel()); return new Addrinfo(runtime, runtime.getClass("Addrinfo"), address, socketType.getSocketType(), socketType); } UnixSocketAddress unix = getUnixSocketAddress(); return Addrinfo.unix(context, runtime.getClass("Addrinfo"), runtime.newString(unix.path())); }
@JRubyMethod(name = "ruby", meta = true) public static IRubyObject ruby(ThreadContext context, IRubyObject recv) { Ruby runtime = context.runtime; RubyHash configHash = (RubyHash) runtime.getModule("RbConfig").getConstant("CONFIG"); IRubyObject bindir = configHash.op_aref(context, runtime.newString("bindir")); IRubyObject ruby_install_name = configHash.op_aref(context, runtime.newString("ruby_install_name")); IRubyObject exeext = configHash.op_aref(context, runtime.newString("EXEEXT")); return Helpers.invoke(context, runtime.getClass("File"), "join", bindir, ruby_install_name.callMethod(context, "+", exeext)); }