Search code examples
rubydocumentationyuidoc

Yuidoc-style comments in Ruby?


How can I use YUIDoc comments in Ruby? The best I can come up with is this:

  ##*
  # Get Query history
  # @type {Array} Past search query objects
  # @param {int} limit The number of objects to return. Defaults to 10. (Max 100).
  # @param {boolean} only_visible limit the search to visible items. Defaults to true.
  #

And this:

  #/**
  # * Get Query history
  # * @type {Array} Past search query objects
  # * @param {int} limit The number of objects to return. Defaults to 10. (Max 100).
  # * @param {boolean} only_visible limit the search to visible items. Defaults to true.
  # */

Solution

  • You have to embed YUIDoc comments inside a Ruby multiline comment, like this:

    =begin
    /**
    * Get Query history
    * @type {Array} Past search query objects
    * @param {int} limit The number of objects to return. Defaults to 10. (Max 100).
    * @param {boolean} only_visible limit the search to visible items. Defaults to true.
    */
    =end
    

    The = character before begin and end must be on the first column of the line.