Categories: None [Edit]
yard-heuristics
YARD-Heuristics
YARD-Heuristics heuristically determines types of parameters and return
values for YARD documentation that doesnΓÇÖt explicitly document it. This
allows you to write documentation that isnΓÇÖt adorned with ΓÇ£obviousΓÇ¥ types,
but still get that information into the output. It also lets you
nice-looking references to parameters and have them be marked up
appropriately in HTML output.
§ Heuristics
The following sections list the various heuristics that YARD-Heuristics
apply for determining types of parameters and return values.
Note that for all heuristics, a type will only be added if none already
exists.
§ Parameter Named “other”
A parameter named ΓÇ£otherΓÇ¥ has the same type as the receiver. This turns
class Point
def ==(other)
into
class Point
# @param [Point] other
def ==(other)
§ Parameter Types Derived by Parameter Name
Parameters to a method with names in the following table has the type
listed on the same row.
| Name | Type |
|--------+-----------|
| index | [Integer] |
| object | [Object] |
| range | [Range] |
| string | [String] |
Thus
class Point
def x_inside?(range)
becomes
class Point
# @param [Range] range
def x_inside?(range)
§ Block Parameters
If the last parameter to a methodΓÇÖs name begins with ΓÇÿ&ΓÇÖ it has the type
[Proc].
class Method
def initialize(&block)
becomes
class Method
# @param [Block] block
def initialize(&block)
§ Return Types by Method Name
For the return type of a method with less than two ‹@return› tags, the
method name is lookup up in the following table and has the type listed on
the same row. For the “type” “self or type”, if a ‹@param› tag exists with
the name ΓÇ£otherΓÇ¥, the type of the ...
Total
Ranking: 53,822 of 199,228
Downloads: 22,468
Daily
Ranking: 87,414 of 199,184
Downloads: 4
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
| Rank | Downloads | Name |
|---|---|---|
| 24,569 | 66,816 | inventory |
| 35,417 | 39,593 | lookout |
| 35,889 | 38,845 | inventory-rake |
| 36,366 | 38,192 | inventory-rake-tasks-yard |
| 43,613 | 29,922 | value |
| 63,509 | 17,878 | lookout-rake |
| 69,431 | 15,760 | ame |
| 74,182 | 14,261 | u |
| 104,457 | 8,303 | lookout-rack |
Depends on
| Rank | Downloads | Name |
|---|---|---|
| 235 | 245,139,448 | yard |
| 24,569 | 66,816 | inventory |
| 35,417 | 39,593 | lookout |
| 35,889 | 38,845 | inventory-rake |
| 63,509 | 17,878 | lookout-rake |
Owners
| # | Gravatar | Handle |
|---|---|---|
| 1 | now |