https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-05-27T17:39:00ZRuby Issue Tracking SystemRuby master - Bug #3350: Protected methods & documentationhttps://redmine.ruby-lang.org/issues/3350?journal_id=112802010-05-27T17:39:00Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>=begin<br>
Hi,</p>
<p>2010/5/27 Marc-Andre Lafortune <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a>:</p>
<blockquote>
<p>Should I change the doc to reflect the current behavior, as per the patch below?</p>
</blockquote>
<p>Agreed. It is more honest.</p>
<blockquote>
<p>I'm curious: what examples exist where one would want to match public and protected methods but not private ones?</p>
</blockquote>
<p>Because whether protected methods can be called are context-sensitive.<br>
Consider this:</p>
<p>class X<br>
def protected_method; end<br>
protected :protected_method<br>
def foo<br>
X.new.protected_method # succeed to call<br>
X.new.methods.include?(:protected_method) #=> true (as expected)<br>
end<br>
end<br>
X.new.foo</p>
<p>If Object#methods returns only public methods, the above expectation<br>
is not satisfied.</p>
<p>Object#methods may be also context-sensitive (IOW, Object#methods<br>
returns different results depending on where it is called), but the<br>
behavior is more difficult (for me) to understand than current one.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p>
<p>=end</p> Ruby master - Bug #3350: Protected methods & documentationhttps://redmine.ruby-lang.org/issues/3350?journal_id=116962010-06-16T02:22:39Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Assignee</strong> set to <i>marcandre (Marc-Andre Lafortune)</i></li></ul><p>=begin<br>
Hi,</p>
<blockquote>
<blockquote>
<p>Should I change the doc to reflect the current behavior, as per the patch below?</p>
</blockquote>
</blockquote>
<p>No objection. Please commit it.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a><br>
=end</p> Ruby master - Bug #3350: Protected methods & documentationhttps://redmine.ruby-lang.org/issues/3350?journal_id=118432010-06-22T13:57:05Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
This issue was solved with changeset r28379.<br>
Marc-Andre, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<p>=end</p>