public static RubyClass getSingletonClass(Ruby runtime, IRubyObject receiver) { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError("can't define singleton"); } else { return receiver.getSingletonClass(); } }
@JRubyMethod(module = true) public static IRubyObject singleton_class(IRubyObject recv) { return recv.getSingletonClass(); }
@JRubyMethod(module = true, compat = RUBY1_9) public static IRubyObject singleton_class(IRubyObject recv) { return recv.getSingletonClass(); }
public static RubyClass getSingletonClass(Ruby runtime, IRubyObject receiver) { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError("can't define singleton"); } else { return receiver.getSingletonClass(); } }
@JRubyMethod(module = true) public static IRubyObject singleton_class(IRubyObject recv) { return recv.getSingletonClass(); }
/** rb_mod_extend_object * */ @JRubyMethod(name = "extend_object", required = 1, visibility = PRIVATE) public IRubyObject extend_object(IRubyObject obj) { obj.getSingletonClass().includeModule(this); return obj; }
@JRubyMethod public static IRubyObject extended(ThreadContext context, IRubyObject self, IRubyObject object) { RubyClass singleton = object.getSingletonClass(); singleton.include(context, self); return singleton; }
@JRubyMethod public static IRubyObject extended(ThreadContext context, IRubyObject self, IRubyObject object) { RubyClass singleton = object.getSingletonClass(); singleton.include(context, self); return singleton; }
/** rb_mod_extend_object * */ @JRubyMethod(name = "extend_object", required = 1, visibility = PRIVATE) public IRubyObject extend_object(IRubyObject obj) { obj.getSingletonClass().includeModule(this); return obj; }
@JRubyMethod public static IRubyObject extended(ThreadContext context, IRubyObject self, IRubyObject object) { if (!(self instanceof RubyModule)) { throw context.runtime.newTypeError(self, context.runtime.getModule()); } RubyClass singleton = object.getSingletonClass(); singleton.include(new IRubyObject[] {self}); return singleton; }
public static RubyClass getSingletonClass(Ruby runtime, IRubyObject receiver) { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError(runtime.is1_9() ? "can't define singleton" : ("no virtual class for " + receiver.getMetaClass().getBaseName())); } else { return receiver.getSingletonClass(); } }
@JRubyMethod public static IRubyObject extended(ThreadContext context, IRubyObject self, IRubyObject object) { if (!(self instanceof RubyModule)) { throw context.runtime.newTypeError(self, context.runtime.getModule()); } RubyClass singleton = object.getSingletonClass(); singleton.include(new IRubyObject[] {self}); return singleton; }
private static RubyClass checkClassForDef(ThreadContext context, IRScope method, IRubyObject obj) { if (obj instanceof RubyFixnum || obj instanceof RubySymbol || obj instanceof RubyFloat) { throw context.runtime.newTypeError(str(context.runtime, "can't define singleton method \"", method.getName(), "\" for ", obj.getMetaClass().rubyBaseName())); } // if (obj.isFrozen()) throw context.runtime.newFrozenError("object"); return obj.getSingletonClass(); }
public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError("can't define singleton method \"" + name + "\" for " + receiver.getMetaClass().getBaseName()); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } RubyClass rubyClass = receiver.getSingletonClass(); return rubyClass; }
public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError("can't define singleton method \"" + name + "\" for " + receiver.getMetaClass().getBaseName()); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } RubyClass rubyClass = receiver.getSingletonClass(); return rubyClass; }
private static RubyClass checkClassForDef(ThreadContext context, IRScope method, IRubyObject obj) { if (obj instanceof RubyFixnum || obj instanceof RubySymbol || obj instanceof RubyFloat) { throw context.runtime.newTypeError(str(context.runtime, "can't define singleton method \"", method.getName(), "\" for ", obj.getMetaClass().rubyBaseName())); } // if (obj.isFrozen()) throw context.runtime.newFrozenError("object"); return obj.getSingletonClass(); }
/** rb_mod_extend_object * */ @JRubyMethod(name = "extend_object", required = 1, visibility = PRIVATE) public IRubyObject extend_object(IRubyObject obj) { if (!isModule()) { throw getRuntime().newTypeError(this, getRuntime().getModule()); } obj.getSingletonClass().includeModule(this); return obj; }
public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError(str(runtime, "can't define singleton method \"", ids(runtime, name), "\" for ", types(runtime, receiver.getMetaClass()))); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } RubyClass rubyClass = receiver.getSingletonClass(); return rubyClass; }
public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException { if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) { throw runtime.newTypeError(str(runtime, "can't define singleton method \"", ids(runtime, name), "\" for ", types(runtime, receiver.getMetaClass()))); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } RubyClass rubyClass = receiver.getSingletonClass(); return rubyClass; }
/** rb_mod_extend_object * */ @JRubyMethod(name = "extend_object", required = 1, visibility = PRIVATE) public IRubyObject extend_object(IRubyObject obj) { if (!isModule()) { throw getRuntime().newTypeError(this, getRuntime().getModule()); } obj.getSingletonClass().includeModule(this); return obj; }