-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@option tag does not pick up keyword arguments #729
Comments
The # @option opts x [Fixnum] the Nth value
def foo(opts={}) end Note the "opts" there. Right now it should not even be possible to specify keyword args using the |
Currently, I’m using the @param tag as a workaround, but that only works for explicitly declared kwargs (i.e. If (just a raw thought) using something like kwargs as a mandatory option Hash name for the existing tag wouldn’t work, then a |
Can you provide the docstring you are testing that is behaving incorrectly? |
Sure: # Guess the file’s text encoding.
# @param guessers [Array<Guesser>] the guessers to use, in order.
# @option options [Boolean] :with_dummies should dummy Encodings be included in the guesses?
# @option options [Float] :good_enough the confidence level >= which no further guesses are needed.
# @option options [Float] :never_mind the confidence level < which guesses are discarded.
# @return (see self.guess_encoding)
def guess_encoding(*guessers, **options)
File.guess_encoding(self, *guessers, **options)
end I only specify |
I am making heavy use of new Ruby features such as keyword arguments, so I would appreciate this feature. I am in favor of adding a
|
+1. I'm heavily using keyword arguments at the moment. I've also noticed that yard doesn't like required keyword arguments at this point.
|
+1.
|
The above change plus the merged #785 PR should allow you to use kw arg splats alongside required kwarg params, though the semantics are admittedly a little wonky. A |
Ruby 2 style keyword arguments documented via the
@option
tag are ignored in the final YARD documentation – instead, the generic description for the assigned option hash name is displayed.The text was updated successfully, but these errors were encountered: