How to document a fixed size array when arguments can be multi typed? #1579
Unanswered
aaronmallen
asked this question in
Q&A
Replies: 1 comment 1 reply
-
YARD doesn't really contain a type system, although there are some intuitive conventions used (and parsed by the yard type parser), but these are not enforced anywhere. Because of this, you can ultimately use whatever syntax you prefer, to communicate the type. One thing you might consider is splitting this into two types-- specifically: # @param foo [Array(Integer, String), Array(Integer, Symbol)] ... This would be supported by the type parser:
You could also use the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Based on the information provided here I can specify a fixed sized array with
()
but how do I document the fact that the second argument could be aString
or aSymbol
? For exampleArray(Integer, <String, Symbol>)
is parsed as "an Array containing (an Integer followed by an Array of (Strings, Symbols))". What is the correct way to document for this use case?Beta Was this translation helpful? Give feedback.
All reactions