How should I provide YARD/RDoc documentation for Ruby keyword arguments?

Should I just continue to use the @param keyword?

Yes.


YARD recognizes keyword arguments. Use @param to document a single method parameter (either regular or keyword) with a given name, type and optional description:

# @param query [String] The search string
# @param exact_match [Boolean] whether to do an exact match
# @param results_per_page [Integer] number of results
def search(query, exact_match: false, results_per_page: 10)
  # ...
end

Source: YARD Tags @param at rubydoc.info

Leave a Comment