Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes not in methods TOC? #1053

Open
BurdetteLamar opened this issue Nov 13, 2023 · 3 comments · May be fixed by #1117
Open

Attributes not in methods TOC? #1053

BurdetteLamar opened this issue Nov 13, 2023 · 3 comments · May be fixed by #1117

Comments

@BurdetteLamar
Copy link
Member

A class/module page documents its attributes in a section separate from that for its other instance methods. The TOC at the left links to the non-attribute methods, but not to the attribute-generated methods.

Internally, there seems to be no distinction between non-attribute methods and attribute-generated methods. Over at stackoverflow.com, queries about determining which way a method was defined go unanswered.

So my question is this: If an attribute-generated method is a full-fledged method, indistinquishable from a non-attribute method, should it not be in the left TOC?

@okuramasafumi
Copy link
Contributor

@hsbt Is this an intended behavior? We can add "attributes" header to the TOC that might provide better user experiences.
If we decide to add "attributes" header to TOC, I can implement it (since I did some research and found a place to modify).
(Btw I'm asking this to hsbt because he's on the authors list in gemspec)

@BurdetteLamar
Copy link
Member Author

Is not an attribute a first-class method? Indistinguishable from others? If so, should it not be listed in the usual way?

@okuramasafumi
Copy link
Contributor

@BurdetteLamar AFAIK, using defined? returns the same method value for methods defined with def and attr_reader, although the internal implementations are different (for example, TracePoint handles them differently).
From users' perspective, they are all methods and Indistinguishable, so putting attributes in method list makes sense to me.
As a reference, YARD displays attribute list separately from method list (see https://www.rubydoc.info/gems/alba/Alba/Resource as a concrete example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants