private_class_method(...)
public
Makes existing class methods private.
Often used to hide the default constructor new.
class SimpleSingleton
private_class_method :new
def SimpleSingleton.create(*args, &block)
@me = new(*args, &block) if ! @me
@me
end
end
Show source
/*
* call-seq:
* mod.private_class_method(symbol, ...) => mod
*
* Makes existing class methods private. Often used to hide the default
* constructor <code>new</code>.
*
* class SimpleSingleton
* private_class_method :new
* def SimpleSingleton.create(*args, &block)
* @me = new(*args, &block) if ! @me
* @me
* end
* end
*/
static VALUE
rb_mod_private_method(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
set_method_visibility(CLASS_OF(obj), argc, argv, NOEX_PRIVATE);
return obj;
}