Project

General

Profile

Actions

Bug #10691

closed

Bad or Non-existent class names listed on 'Index of Files, Classes & Methods in Ruby' page.

Added by JuanitoFatas (Juanito Fatas) over 9 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
[ruby-core:67297]

Description

On this page: Index of Files, Classes & Methods in Ruby 2.2.0 (Ruby 2.2.0)

There are Classes:

I found some of the classes listed here does not exist:

Complex::compatible
fatal
unknown
Rational::compatible

What do I mean by not exist? That is if I type fatal in irb:

irb(main):001:0> fatal
NameError: undefined local variable or method `fatal' for main:Object
	from (irb):1
	from /Users/Juan/.rubies/ruby-2.2.0/bin/irb:11:in `<main>'
irb(main):002:0> Fatal
NameError: uninitialized constant Fatal
	from (irb):2
	from /Users/Juan/.rubies/ruby-2.2.0/bin/irb:11:in `<main>'

Other versions of documentation also has this problem.

http://www.ruby-doc.org/core-2.0.0/
http://www.ruby-doc.org/core-2.1.5/
http://www.ruby-doc.org/core-2.2.0/

I want to remove it but cannot find which repository to work on.

So I report here, Thanks!


Files

ruby-classes.png (47.4 KB) ruby-classes.png ruby classes screenshot on http://www.ruby-doc.org/core-2.2.0/ page JuanitoFatas (Juanito Fatas), 01/02/2015 03:13 PM
fatal-doc-10691.patch (897 Bytes) fatal-doc-10691.patch jeremyevans0 (Jeremy Evans), 08/12/2019 02:49 AM

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

Complex::compatible, unknown, Rational::compatible were removed by Ruby 2.6.0. fatal is still documented, but that exists even though you cannot reference it directly:

f = ObjectSpace.each_object(Class){|c| break c if c.name && c.name.downcase == c.name}
# => fatal
f.ancestors
# => [fatal, Exception, Object, Kernel, BasicObject]

The documentation for fatal states You are not able to rescue fatal. That appears to be incorrect:

f = ObjectSpace.each_object(Class){|c| break c if c.name && c.name.downcase == c.name}

begin
  raise f
rescue f
  2
end
# => 2

Attached is a patch that removes that sentence from fatal's documentation. I'm not sure if we actually want to prevent the rescuing of fatal instead, though.

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

The documentation is not accurate indeed.
To be accurate, it is impossible to rescue the fatal raised by rb_fatal function.

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

Thread.start{Thread.stop}
begin
  Thread.stop
rescue Exception => fatal
  p fatal.class #=> fatal
end
Actions #4

Updated by jeremyevans (Jeremy Evans) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|404850e13446c79fb6142f1b32b219753e5cd726.


Remove documentation that fatal cannot be rescued [ci skip]

You can rescue it:

f = ObjectSpace.each_object(Class){|c| break c if c.name == 'fatal'}
begin
raise f
rescue f
2
end # => 2

It's not a good idea to rescue fatal exceptions you didn't generate
yourself, though.

Fixes [Bug #10691]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0