rubyyard

YARD convention for "any" object as a parameter


How to document a YARD parameter that could be of any type possible?

Is there a convention for it?

This is similar to Any type in TypeScript

# @param [?] var1
def create_foo(var1)
  # var1 could be anything
end

Solution

  • Since almost every object in Ruby inherits behavior from the class Object, # @param [Object] var1 seems like an appropriate choice.

    A few examples from rubygems/rubygems and lostisland/faraday