How to document dynamically defined methods in YARD #181
heronshoes
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Vector functions such as #mean, #abs, #>, etc. are dynamically created by
define_methodusing Arrow's compute functions in RedAmber. But I had no idea to document them in YARD. I finally found a solution and updated (#129). I will take a note here.Use Class method to define methods
Make a class method to define method and use it like DSL.
Document them
Attach documents in class method for common documents with @!macro (1).
Non-attaching (new) macros are defined for the options (2).
Main part of the document are defined on the top of method (3).
@!methodwill properly define arguments and default options (4).Aliases should be defined by
alias_method(5). It can be defined by class method in some cases, butalias_methodcan handleAlso known as:.Results are: https://heronshoes.github.io/red_amber/RedAmber/Vector.html#approximate_median-instance_method
YARD document: https://rubydoc.info/gems/yard/file/docs/Tags.md#macro
Beta Was this translation helpful? Give feedback.
All reactions