Thanks. It°«s only partially unrelated, because while it would be great for
RDoc to do the right thing (always treat `foo/foo=` method pairs as if they
were attribute writers), the `undef` was done *specifically* to avoid the
°»redefining a method°… warning.

-a

On Thu, Dec 3, 2020 at 6:05 PM Jeremy Evans <code / jeremyevans.net> wrote:

> On 12/03 05:44, Austin Ziegler wrote:
> > What does this mean?
> >
> > > Considering that you can alias a method to itself to avoid the warning,
> > and therefore do not need to remove the method first (which would causea
> > race condition), I am dropping my request to add
> > `expected_redefined_method?(method_name)`.
>
> As shown by Urabe-san:
>
> ```ruby
> def foo
> end
>
> # This avoids the redefinition warning
> alias foo foo
>
> # This would normally result in a redefinition warning in verbose mode,
> # if not for the alias above.
> def foo
> end
> ```
>
> > I have code that I???ve written to get around some rdoc silliness that
> does:
> >
> >   # rdoc documentation for foo.
> >   attr_writer :foo
> >   undef :foo=
> >   def foo=(x) #:nodoc:
> >     # specialized foo assignment code
> >   end
> >
> > If I didn???t do this, RDoc documents both the attribute and the `foo=`
> > method (or it did the last time I checked) even though all I want
> > documented is the attribute for readability. How would I make it so that
> I
> > don???t need to do `undef :foo=` here, as that has been one thing that
> has
> > failed this code (_hard_) with both type analyzers for Ruby.
>
> This seems to be an unrelated issue.  I would avoid the attr_writer and
> the undef.  If you just want RDoc to mark this as an attribute method
> instead of general method, then you may want to submit a pull request to
> rdoc to add markup syntax to be able to flag a regular method as an
> attribute method.
>
> Thanks,
> Jeremy
>
> Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
>


-- 
Austin Ziegler  halostatue / gmail.com  austin / halostatue.ca
http://www.halostatue.ca/  http://twitter.com/halostatue
(supressed text/html)
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>