Mark a parameter as optional (or has a default) with YARD
YARD now supports param defaults automatically.
YARD automatically figures out the default value based on the method definition. Sweedish!
For example, the following code documentation will produce the subsequent YARD doc:
Code Documentation
# Squares a number.
#
# @param number [Integer] The number to square.
#
def square_a_number(number = 2)
number * number
end
Resulting YARD Documentation
Parameters:
number (Integer optional) (defaults to: 2)