Skip to content

What is the proper way to document a class returned from Data.define? #1553

Answered by lsegal
jcouball asked this question in Q&A
Discussion options

You must be logged in to vote

The extend keyword in Ruby does not define a superclass, it defines a mixin. Mixins are defined in parallel to class hierarcy. YARD would list the mixin as one of the ancestors, but it shouldn't be listing it as as the base class. Indeed following the steps in the comment you referenced is the correct way to do this, namely defining the class, not using extend. More importantly, extend applies to the metaclass, so it's not even really changing the ancestor chain of the class in the way you'd think (it's a bit meta).

IMO the solution here is the same as in the referenced issue, namely, you should just be removing the dynamism and defining the superclass directly:

class LocoMotion::Actions::M…

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lsegal
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #1533 on August 26, 2024 07:37.