I have this method in a class I am using
def binary_search(a,x)
# ...
end
and I want in the documentation for the parameters to appear as def binary_search(array, key)
and not binary_search(a,x)
. I have tried to use the d开发者_开发技巧ocumentation modifier # :binary_search: array, key
with no success. I know this a little thing, but if somebody knows how to do make the parameters different in the documentation than in the actual source code, can you please show me? Thanks.
You're supposed to be able to use the :call-seq:
directive in the method header comment as follows:
##
# Pass array and key.
#
# :call-seq:
# binary_search(array, key)
def binary_search(a, x)
# ...
end
I haven't got this working yet. I'm using RDoc V1.0.1 and Ruby 1.8.7.
Maybe try # :args: thing_to_try
like so: (be careful about whitespace)
# rdoc-2.5.8/lib/rdoc/parser/ruby.rb:48
# The parser extracts the arguments from the method definition. You can
# override this with a custom argument definition using the :args: directive:
##
# This method tries over and over until it is tired
def go_go_go(thing_to_try, tries = 10) # :args: thing_to_try
puts thing_to_try
go_go_go thing_to_try, tries - 1
end
精彩评论