本文整理了Java中org.jruby.RubyClass.defineModuleUnder
方法的一些代码示例,展示了RubyClass.defineModuleUnder
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.defineModuleUnder
方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:defineModuleUnder
暂无
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static void create(Ruby runtime) {
RubyModule mNet = runtime.getModule("Net");
RubyClass cBufferedIO = (RubyClass)mNet.getConstant("BufferedIO");
cBufferedIO.defineAnnotatedMethods(NetProtocolBufferedIO.class);
RubyModule mNativeImpl = cBufferedIO.defineModuleUnder("NativeImplementation");
mNativeImpl.defineAnnotatedMethods(NativeImpl.class);
}
代码示例来源:origin: org.jruby/jruby-complete
public static void create(Ruby runtime) {
RubyModule mNet = runtime.getModule("Net");
RubyClass cBufferedIO = (RubyClass)mNet.getConstant("BufferedIO");
cBufferedIO.defineAnnotatedMethods(NetProtocolBufferedIO.class);
RubyModule mNativeImpl = cBufferedIO.defineModuleUnder("NativeImplementation");
mNativeImpl.defineAnnotatedMethods(NativeImpl.class);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static void create(Ruby runtime) {
RubyModule mNet = runtime.getModule("Net");
RubyClass cBufferedIO = (RubyClass)mNet.getConstant("BufferedIO");
cBufferedIO.defineAnnotatedMethods(NetProtocolBufferedIO.class);
RubyModule mNativeImpl = cBufferedIO.defineModuleUnder("NativeImplementation");
mNativeImpl.defineAnnotatedMethods(NativeImpl.class);
}
代码示例来源:origin: org.jruby/jruby-core
public static void create(Ruby runtime) {
RubyModule mNet = runtime.getModule("Net");
RubyClass cBufferedIO = (RubyClass)mNet.getConstant("BufferedIO");
cBufferedIO.defineAnnotatedMethods(NetProtocolBufferedIO.class);
RubyModule mNativeImpl = cBufferedIO.defineModuleUnder("NativeImplementation");
mNativeImpl.defineAnnotatedMethods(NativeImpl.class);
}
代码示例来源:origin: org.jruby/jruby-complete
public void load(Ruby runtime, boolean wrap) {
RubyClass rb_cCGI = runtime.defineClass("CGI", runtime.getObject(), runtime.getObject().getAllocator());
RubyModule rb_mEscape = rb_cCGI.defineModuleUnder("Escape");
rb_mEscape.defineAnnotatedMethods(CGIEscape.class);
// We do this in cgi/util.rb to work around jruby/jruby#4531.
// rb_mUtil.prependModule(rb_mEscape);
// rb_mEscape.extend_object(rb_cCGI);
}
代码示例来源:origin: org.jruby/jruby-core
public void load(Ruby runtime, boolean wrap) {
RubyClass rb_cCGI = runtime.defineClass("CGI", runtime.getObject(), runtime.getObject().getAllocator());
RubyModule rb_mEscape = rb_cCGI.defineModuleUnder("Escape");
rb_mEscape.defineAnnotatedMethods(CGIEscape.class);
// We do this in cgi/util.rb to work around jruby/jruby#4531.
// rb_mUtil.prependModule(rb_mEscape);
// rb_mEscape.extend_object(rb_cCGI);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static void createIconv(Ruby runtime) {
RubyClass iconvClass = runtime.defineClass("Iconv", runtime.getObject(), ICONV_ALLOCATOR);
iconvClass.defineAnnotatedMethods(RubyIconv.class);
RubyModule failure = iconvClass.defineModuleUnder("Failure");
RubyClass argumentError = runtime.getArgumentError();
String[] iconvErrors = {"IllegalSequence", "InvalidCharacter", "InvalidEncoding",
"OutOfRange", "BrokenLibrary"};
for (int i = 0; i < iconvErrors.length; i++) {
RubyClass subClass = iconvClass.defineClassUnder(iconvErrors[i], argumentError, RubyFailure.ICONV_FAILURE_ALLOCATOR);
subClass.defineAnnotatedMethods(RubyFailure.class);
subClass.includeModule(failure);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static void createIconv(Ruby runtime) {
RubyClass iconvClass = runtime.defineClass("Iconv", runtime.getObject(), ICONV_ALLOCATOR);
iconvClass.defineAnnotatedMethods(RubyIconv.class);
RubyModule failure = iconvClass.defineModuleUnder("Failure");
RubyClass argumentError = runtime.getArgumentError();
String[] iconvErrors = {"IllegalSequence", "InvalidCharacter", "InvalidEncoding",
"OutOfRange", "BrokenLibrary"};
for (int i = 0; i < iconvErrors.length; i++) {
RubyClass subClass = iconvClass.defineClassUnder(iconvErrors[i], argumentError, RubyFailure.ICONV_FAILURE_ALLOCATOR);
subClass.defineAnnotatedMethods(RubyFailure.class);
subClass.includeModule(failure);
}
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyClass createIOClass(Ruby runtime) {
RubyClass ioClass = runtime.defineClass("IO", runtime.getObject(), IO_ALLOCATOR);
ioClass.setClassIndex(ClassIndex.IO);
ioClass.setReifiedClass(RubyIO.class);
ioClass.kindOf = new RubyModule.JavaClassKindOf(RubyIO.class);
ioClass.includeModule(runtime.getEnumerable());
ioClass.defineAnnotatedMethods(RubyIO.class);
// Constants for seek
ioClass.setConstant("SEEK_SET", runtime.newFixnum(PosixShim.SEEK_SET));
ioClass.setConstant("SEEK_CUR", runtime.newFixnum(PosixShim.SEEK_CUR));
ioClass.setConstant("SEEK_END", runtime.newFixnum(PosixShim.SEEK_END));
ioClass.defineModuleUnder("WaitReadable");
ioClass.defineModuleUnder("WaitWritable");
return ioClass;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyClass createIOClass(Ruby runtime) {
RubyClass ioClass = runtime.defineClass("IO", runtime.getObject(), IO_ALLOCATOR);
ioClass.setClassIndex(ClassIndex.IO);
ioClass.setReifiedClass(RubyIO.class);
ioClass.kindOf = new RubyModule.JavaClassKindOf(RubyIO.class);
ioClass.includeModule(runtime.getEnumerable());
ioClass.defineAnnotatedMethods(RubyIO.class);
// Constants for seek
ioClass.setConstant("SEEK_SET", runtime.newFixnum(PosixShim.SEEK_SET));
ioClass.setConstant("SEEK_CUR", runtime.newFixnum(PosixShim.SEEK_CUR));
ioClass.setConstant("SEEK_END", runtime.newFixnum(PosixShim.SEEK_END));
ioClass.defineModuleUnder("WaitReadable");
ioClass.defineModuleUnder("WaitWritable");
return ioClass;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyClass createIOClass(Ruby runtime) {
RubyClass ioClass = runtime.defineClass("IO", runtime.getObject(), IO_ALLOCATOR);
ioClass.index = ClassIndex.IO;
ioClass.setReifiedClass(RubyIO.class);
ioClass.kindOf = new RubyModule.JavaClassKindOf(RubyIO.class);
ioClass.includeModule(runtime.getEnumerable());
// TODO: Implement tty? and isatty. We have no real capability to
// determine this from java, but if we could set tty status, then
// we could invoke jruby differently to allow stdin to return true
// on this. This would allow things like cgi.rb to work properly.
ioClass.defineAnnotatedMethods(RubyIO.class);
// Constants for seek
ioClass.setConstant("SEEK_SET", runtime.newFixnum(Stream.SEEK_SET));
ioClass.setConstant("SEEK_CUR", runtime.newFixnum(Stream.SEEK_CUR));
ioClass.setConstant("SEEK_END", runtime.newFixnum(Stream.SEEK_END));
if (runtime.is1_9()) {
ioClass.defineModuleUnder("WaitReadable");
ioClass.defineModuleUnder("WaitWritable");
}
return ioClass;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyClass createIOClass(Ruby runtime) {
RubyClass ioClass = runtime.defineClass("IO", runtime.getObject(), IO_ALLOCATOR);
ioClass.index = ClassIndex.IO;
ioClass.setReifiedClass(RubyIO.class);
ioClass.kindOf = new RubyModule.JavaClassKindOf(RubyIO.class);
ioClass.includeModule(runtime.getEnumerable());
// TODO: Implement tty? and isatty. We have no real capability to
// determine this from java, but if we could set tty status, then
// we could invoke jruby differently to allow stdin to return true
// on this. This would allow things like cgi.rb to work properly.
ioClass.defineAnnotatedMethods(RubyIO.class);
// Constants for seek
ioClass.setConstant("SEEK_SET", runtime.newFixnum(Stream.SEEK_SET));
ioClass.setConstant("SEEK_CUR", runtime.newFixnum(Stream.SEEK_CUR));
ioClass.setConstant("SEEK_END", runtime.newFixnum(Stream.SEEK_END));
if (runtime.is1_9()) {
ioClass.defineModuleUnder("WaitReadable");
ioClass.defineModuleUnder("WaitWritable");
}
return ioClass;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
RubyModule constants = fileClass.defineModuleUnder("Constants");
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
RubyModule constants = fileClass.defineModuleUnder("Constants");
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
static void createSocket(Ruby runtime) {
RubyClass rb_cSocket = runtime.defineClass("Socket", runtime.getClass("BasicSocket"), SOCKET_ALLOCATOR);
RubyModule rb_mConstants = rb_cSocket.defineModuleUnder("Constants");
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
static void createSocket(Ruby runtime) {
RubyClass rb_cSocket = runtime.defineClass("Socket", runtime.getClass("BasicSocket"), SOCKET_ALLOCATOR);
RubyModule rb_mConstants = rb_cSocket.defineModuleUnder("Constants");
代码示例来源:origin: org.jruby/jruby-core
static void createSocket(Ruby runtime) {
RubyClass rb_cSocket = runtime.defineClass("Socket", runtime.getClass("BasicSocket"), SOCKET_ALLOCATOR);
RubyModule rb_mConstants = rb_cSocket.defineModuleUnder("Constants");
代码示例来源:origin: org.jruby/jruby-complete
static void createSocket(Ruby runtime) {
RubyClass rb_cSocket = runtime.defineClass("Socket", runtime.getClass("BasicSocket"), SOCKET_ALLOCATOR);
RubyModule rb_mConstants = rb_cSocket.defineModuleUnder("Constants");
代码示例来源:origin: org.jruby/jruby-complete
RubyModule constants = fileClass.defineModuleUnder("Constants");
代码示例来源:origin: org.jruby/jruby-core
RubyModule constants = fileClass.defineModuleUnder("Constants");
内容来源于网络,如有侵权,请联系作者删除!