-
Ruby 2.7 introduces argument forwarding, which looks like this: def accept_any_args(...)
call_with_any_args(...)
end If argument forwarding is used with YARD, one might attempt to document their methods like this: # Inspects some options.
#
# @param [Hash] options Options to inspect.
# @return [String] Inspected object.
def my_method(...)
private_method(...)
end
private
def private_method(**options)
options.inspect
end However, when
How should the above code be documented with YARD? |
Beta Was this translation helpful? Give feedback.
Answered by
lsegal
Dec 27, 2020
Replies: 1 comment
-
The general approach here would be the same as the case where you have a # @overload my_method(a, b)
# @param a [String] the first parameter
# @param b [Boolean] the second parameter
def my_method(...) = other(...) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lsegal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The general approach here would be the same as the case where you have a
*args
or**kwargs
method-- you would use@overload
to define a synthesized method signature: