-
Notifications
You must be signed in to change notification settings - Fork 438
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
feature: Render mixed-in methods and constants with --embed-mixins
#842
Conversation
--embed-mixins
--embed-mixins
4841259
to
563c87c
Compare
I've pushed an update to this PR to ensure that code object visibility is respected (which was a bug in the original patch). |
@aycabta I'm curious if you have feedback on this feature? It's off by default but I think would be a real improvement to standard-library classes like Array that inherit significant functionality from Enumerable. |
@aycabta This feature is live at https://nokogiri.org/rdoc/Nokogiri/XML/Node.html#method-i-at_css if you'd like to see what it looks like. Is this something you would consider merging? |
563c87c
to
5c46830
Compare
Rebased off v6.5.0. I still think this is a valuable feature to consider. It's been in use at https://nokogiri.org/rdoc/ for the past year, see https://nokogiri.org/rdoc/Nokogiri/XML/Node.html#method-i-css for example. |
5c46830
to
629de31
Compare
629de31
to
7262a33
Compare
7262a33
to
a3402af
Compare
a3402af
to
9f2a9f2
Compare
@hsbt If you get some time to review this, I still think it's a good feature, and it's been live on the nokogiri.org site for several years now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some small suggestions, but overall looks good to me.
How does it affect documentation displayed by ri
though?
@st0012 Thank you for your review!
I hadn't even considered ri as a target, since I don't usually use it. I will explore what's necessary to extend the ri content as well. |
@st0012 So If I generate the ri files with
|
@flavorjones 👋 just want to say that I didn't forget this PR. @colby-swandale and I just got commit bit to this project and we will likely do some refactors/test improvements...etc. with some bug fixes first. And then we'll start merging features. |
No sweat, @st0012! Let me know if I can be helpful with anything. |
52c067e
to
50471e7
Compare
Rebased onto current |
When `--embed-mixins` option is set: - methods from an `extend`ed module are documented as singleton methods - attrs from an `extend`ed module are documented as class attributes - methods from an `include`ed module are documented as instance methods - attrs from an `include`ed module are documented as instance attributes - constants from an `include`ed module are documented Sections are created when needed, and Darkfish's template annotates each of these mixed-in CodeObjects. We also respect the mixin methods' visibility. This feature is inspired by Yard's option of the same name.
Co-authored-by: Stan Lo <stan001212@gmail.com>
50471e7
to
b0f6801
Compare
Rebased onto current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with RDoc and I think it works well. Thank you for this great addition 🎉
`--embed-mixins` (ruby/rdoc#842) * Embed mixed-in methods and constants with `--embed-mixins` When `--embed-mixins` option is set: - methods from an `extend`ed module are documented as singleton methods - attrs from an `extend`ed module are documented as class attributes - methods from an `include`ed module are documented as instance methods - attrs from an `include`ed module are documented as instance attributes - constants from an `include`ed module are documented Sections are created when needed, and Darkfish's template annotates each of these mixed-in CodeObjects. We also respect the mixin methods' visibility. This feature is inspired by Yard's option of the same name. * Add comment to document why we set object visibility Co-authored-by: Stan Lo <stan001212@gmail.com> * Add the mixin_from attribute to CodeObject's initializer * Add test coverage for private mixed-in attributes. --------- ruby/rdoc@481c2ce660 Co-authored-by: Stan Lo <stan001212@gmail.com>
woo hoo! thank you, @st0012! |
When
--embed-mixins
option is set:extend
ed module are documented as singleton methodsextend
ed module are documented as class attributesinclude
ed module are documented as instance methodsinclude
ed module are documented as instance attributesinclude
ed module are documentedSections are created when needed, and Darkfish's template annotates
each of these mixed-in CodeObjects.
This feature is inspired by Yard's option of the same name.
Example class:
Currently this renders like:
With
--embed-mixins
it renders like: