Search code examples
rubyrdoc

Simple Rdoc Question about documentation modifiers


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 documentation 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.


Solution

  • 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.