本文整理了Java中org.jruby.RubyClass.allocate
方法的一些代码示例,展示了RubyClass.allocate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.allocate
方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:allocate
暂无
代码示例来源:origin: org.jruby/jruby-complete
static RubyException newNameError(IRubyObject recv, IRubyObject message, IRubyObject name, boolean privateCall) {
final RubyClass klass = (RubyClass) recv;
RubyNameError newError = (RubyNameError) klass.allocate();
newError.callInit(message, name, Block.NULL_BLOCK);
newError.privateCall = privateCall;
return newError;
}
代码示例来源:origin: org.jruby/jruby-complete
public static JZlibRubyGzipReader newInstance(IRubyObject recv, IRubyObject[] args) {
RubyClass klass = (RubyClass) recv;
JZlibRubyGzipReader result = (JZlibRubyGzipReader) klass.allocate();
result.callInit(args, Block.NULL_BLOCK);
return result;
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
klass.reifyWithAncestors();
return klass.allocate();
}
};
代码示例来源:origin: org.jruby/jruby-complete
public static RubyException newNoMethodError(IRubyObject recv, IRubyObject message, IRubyObject name, IRubyObject args) {
RubyClass klass = (RubyClass)recv;
RubyException newError = (RubyException) klass.allocate();
newError.callInit(message, name, args, Block.NULL_BLOCK);
return newError;
}
代码示例来源:origin: org.jruby/jruby-complete
@Deprecated
public static IRubyObject new19(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
return ((RubyClass) recv).allocate().callMethod(context, "initialize", args);
}
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyException newNoMethodError(IRubyObject recv, IRubyObject message, IRubyObject name, IRubyObject args, boolean privateCall) {
RubyClass klass = (RubyClass)recv;
RubyNoMethodError newError = (RubyNoMethodError) klass.allocate();
newError.callInit(message, name, args, Block.NULL_BLOCK);
newError.privateCall = privateCall;
return newError;
}
代码示例来源:origin: asciidoctor/asciidoctorj
public static IRubyObject wrap(final Ruby rubyRuntime, final OutputStream out) {
final RubyClass rubyClass = getOrCreateOutputStreamWrapperClass(rubyRuntime);
final IRubyObject wrapper = rubyClass.allocate();
((RubyOutputStreamWrapper) wrapper).setOut(out);
return wrapper;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "new", omit = true)
public IRubyObject newInstance(ThreadContext context, IRubyObject arg0, Block block) {
IRubyObject obj = allocate();
baseCallSites[CS_IDX_INITIALIZE].call(context, obj, obj, arg0, block);
return obj;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "new", rest = true, omit = true)
public IRubyObject newInstance(ThreadContext context, IRubyObject[] args, Block block) {
IRubyObject obj = allocate();
baseCallSites[CS_IDX_INITIALIZE].call(context, obj, obj, args, block);
return obj;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "new", meta = true)
public static RubyGzipFile newInstance(IRubyObject recv, Block block) {
RubyClass klass = (RubyClass) recv;
RubyGzipFile result = (RubyGzipFile) klass.allocate();
result.callInit(IRubyObject.NULL_ARRAY, block);
return result;
}
代码示例来源:origin: org.jruby/jruby-complete
/** rb_class_new_instance
*
*/
@JRubyMethod(name = "new", omit = true)
public IRubyObject newInstance(ThreadContext context, Block block) {
IRubyObject obj = allocate();
baseCallSites[CS_IDX_INITIALIZE].call(context, obj, obj, block);
return obj;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "new", omit = true)
public IRubyObject newInstance(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
IRubyObject obj = allocate();
baseCallSites[CS_IDX_INITIALIZE].call(context, obj, obj, arg0, arg1, arg2, block);
return obj;
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public Object unmarshalFrom(Ruby runtime, RubyClass type,
UnmarshalStream unmarshalStream) throws IOException {
IRubyObject result = type.allocate();
unmarshalStream.registerLinkTarget(result);
unmarshalStream.defaultVariablesUnmarshal(result);
return result;
}
};
代码示例来源:origin: org.asciidoctor/asciidoctorj
public static IRubyObject wrap(final Ruby rubyRuntime, final OutputStream out) {
final RubyClass rubyClass = getOrCreateOutputStreamWrapperClass(rubyRuntime);
final IRubyObject wrapper = rubyClass.allocate();
((RubyOutputStreamWrapper) wrapper).setOut(out);
return wrapper;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyRegexp newRegexpFromStr(Ruby runtime, RubyString s, int options) {
RubyRegexp re = (RubyRegexp)runtime.getRegexp().allocate();
re.regexpInitializeString(s, RegexpOptions.fromJoniOptions(options));
return re;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(meta = true)
public static RubyDate _load(ThreadContext context, IRubyObject klass, IRubyObject str) {
IRubyObject a = RubyMarshal.load(context, null, new IRubyObject[] { str }, null);
RubyDate obj = (RubyDate) ((RubyClass) klass).allocate();
return obj.marshal_load(context, a);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "now", meta = true)
public static RubyTime newInstance(ThreadContext context, IRubyObject recv) {
RubyTime obj = (RubyTime) ((RubyClass) recv).allocate();
obj.getMetaClass().getBaseCallSite(RubyClass.CS_IDX_INITIALIZE).call(context, recv, obj);
return obj;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "new", rest = true, meta = true)
public static IRubyObject newInstance(IRubyObject recv, IRubyObject[] args, Block block) {
IRubyObject obj = ((RubyClass)recv).allocate();
obj.callMethod(recv.getRuntime().getCurrentContext(), "initialize", args, block);
return obj;
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "new", rest = true, meta = true)
public static IRubyObject newInstance(IRubyObject recv, IRubyObject[] args, Block block) {
IRubyObject obj = ((RubyClass)recv).allocate();
obj.callMethod(recv.getRuntime().getCurrentContext(), "initialize", args, block);
return obj;
}
代码示例来源:origin: org.jruby/jruby-complete
private IRubyObject userNewUnmarshal() throws IOException {
String className = unmarshalObject(false).asJavaString();
RubyClass classInstance = findClass(className);
IRubyObject result = classInstance.allocate();
registerLinkTarget(result);
IRubyObject marshaled = unmarshalObject();
return classInstance.smartLoadNewUser(result, marshaled);
}
内容来源于网络,如有侵权,请联系作者删除!