Hubro
Hubro

Reputation: 59383

How do I prevent Yard from using the contents of @return as description?

I have nothing useful to write about this function other than specifying what it outputs. If Yard doesn't find a description, it uses the contents of @return instead. Is there any way to prevent that? I want to avoid silly duplication like you see in the example below.

##
# @return [Array<Hash>]
#
#   an array of hashes. Example output:
#
#     [
#       {:name=>"FORNEBU", :municipality=>"BÆRUM", :county=>"AKERSHUS"},
#       {:name=>"FORSAND", :municipality=>"FORSAND", :county=>"ROGALAND"}
#     ]
#

Screenshot

Upvotes: 4

Views: 940

Answers (1)

Saiqul Haq
Saiqul Haq

Reputation: 2397

you can use @example tag

##
# @return [Array<Hash>]
# @example
#   an array of hashes. Example output:
#
#     [
#       {:name=>"FORNEBU", :municipality=>"BÆRUM", :county=>"AKERSHUS"},
#       {:name=>"FORSAND", :municipality=>"FORSAND", :county=>"ROGALAND"}
#     ]
#

output yard output

and the method description will be like this:

#method_name(args) ⇒ Array<Hash>

Upvotes: 1

Related Questions