Project

General

Profile

Misc #15249

Documentation for attr_accessor and attr_reader should be corrected

Added by CaryInVictoria (Cary Swoveland) 6 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
[ruby-core:89540]

Description

The documentation for Module#attr_accessor (v2.5.1) begins, "Defines a named attribute for this module, where the name is symbol.id2name, creating an instance variable (@name) and...". Similarly, the documentation for Module#attr_reader states, "Creates instance variables and...". These statements do not appear to be correct:

class C
  attr_accessor :dog
  attr_reader :cat
end
C.new.instance_variables #=> []

Also available in: Atom PDF