How to document a fixed size array when arguments can be multi typed? #1579
-
Based on the information provided here I can specify a fixed sized array with |
Beta Was this translation helpful? Give feedback.
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.
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
|
character commonly used in other type systems to specify this asArray(Integer, String | Symbol)
, which I think …