Issue #16373 has been updated by jeremyevans0 (Jeremy Evans).

Backport deleted (2.5: UNKNOWN, 2.6: UNKNOWN)
Tracker changed from Bug to Feature

The current RDoc behavior is by design, so this isn't a bug, it's a feature request.

I agree it would be best for RDoc to reflect the reality that Kernel methods are defined in Kernel and not object, because if they were defined in Object, you could not override them in Object and call super to get the default behavior.

I'm against moving Kernel methods to object, because then you cannot override them in Object and call super to get the default behavior (this breaks backwards compatibility).  You also wouldn't be able to do something like:

```ruby
  class Foo < BasicObject
    include Kernel
  end
```

and get the methods.

----------------------------------------
Feature #16373: RDoc for some of the Kernel methods cannot be found in Kernel module
https://bugs.ruby-lang.org/issues/16373#change-85895

* Author: soutaro (Soutaro Matsumoto)
* Status: Open
* Priority: Normal
----------------------------------------
RDoc documentations for some of the `Kernel` methods including `Kernel#then` are registered as `Object` methods. I'd like to propose to move `Kernel` methods listed in `Object` class to `Kernel` class.

The following `ri` results are confusing to me because the `Object` methods are defined in `Kernel` module technically.

```
$ ri Kernel#then
Nothing known about Kernel#then
$ ri Object#then
[Prints documentation]
```

This is because of the implementation of RDoc that it treats `Kernel` methods as if they are defined in `Object`.

- https://github.com/ruby/rdoc/blob/acfb829917336ecbca6036437918c29319db7c04/lib/rdoc/parser/c.rb#L508

I'd like to disable the assignment and make `Kernel` methods listed in `Kernel` module.

**Pros**

- The RDoc structure is more clear and precise
  - (This is essential to me that it makes easier to generate annotations for RBS files.)
- Both of `ri Kernel#then` and `ri Object#then` print the documentation

**Cons**

- The document of `Object` class will be almost empty, which may cause confusion for readers while there is a link to included module, `Kernel`




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>