Method: Module#private
- Defined in:
- vm_method.c
#private ⇒ nil (private) #private(method_name) ⇒ Object (private) #private(method_name, method_name, ...) ⇒ Array (private) #private(array) ⇒ Array (private)
With no arguments, sets the default visibility for subsequently defined methods to private. With arguments, sets the named methods to have private visibility. String arguments are converted to symbols. An Array of Symbols and/or Strings is also accepted. If a single argument is passed, it is returned. If no argument is passed, nil is returned. If multiple arguments are passed, the arguments are returned as an array.
module Mod
def a() end
def b() end
private
def c() end
private :a
end
Mod.private_instance_methods #=> [:a, :c]
Note that to show a private method on RDoc, use :doc:.
2527 2528 2529 2530 2531 |
# File 'vm_method.c', line 2527
static VALUE
rb_mod_private(int argc, VALUE *argv, VALUE module)
{
return set_visibility(argc, argv, module, METHOD_VISI_PRIVATE);
}
|