diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-19 09:34:30 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-19 09:34:30 +0000 |
commit | f34d0ba3eb5e001c5949236764c74c47688ec578 (patch) | |
tree | 333fd193299da1079cb530e88240fc6c3a1b4586 /vm_method.c | |
parent | d33726b837174f12bdf96aafd867b84862386549 (diff) |
More description about the protected attribute of a method
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c index f4ff7989f2..57b805406c 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1669,6 +1669,15 @@ rb_mod_public(int argc, VALUE *argv, VALUE module) * defined methods to protected. With arguments, sets the named methods * to have protected visibility. * String arguments are converted to symbols. + * + * If a method has protected visibility, it is callable only where + * <code>self</code> of the context is the same as the method. + * (method definition or instance_eval). This behavior is different from + * Java's protected method. Usually <code>private</code> should be used. + * + * Note that a protected method is slow because it can't use inline cache. + * + * To show a private method on RDoc, use <code>:doc:</code> instead of this. */ static VALUE @@ -1696,6 +1705,8 @@ rb_mod_protected(int argc, VALUE *argv, VALUE module) * private :a * end * Mod.private_instance_methods #=> [:a, :c] + * + * Note that to show a private method on RDoc, use <code>:doc:</code>. */ static VALUE |